This repository was archived by the owner on Jun 9, 2021. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +22
-1
lines changed
src/main/java/se/bjurr/prnfb/service Expand file tree Collapse file tree 1 file changed +22
-1
lines changed Original file line number Diff line number Diff line change 1515import static se .bjurr .prnfb .service .RepoProtocol .http ;
1616import static se .bjurr .prnfb .service .RepoProtocol .ssh ;
1717
18+ import java .net .URI ;
19+ import java .net .URISyntaxException ;
1820import java .util .Collections ;
1921import java .util .Iterator ;
2022import java .util .List ;
@@ -1362,7 +1364,26 @@ public String perform() throws RuntimeException {
13621364 if (allUrls .isEmpty ()) {
13631365 return "" ;
13641366 }
1365- return allUrls .iterator ().next ();
1367+ final String rawUrlString = allUrls .iterator ().next ();
1368+ try {
1369+ final URI uri = new URI (rawUrlString );
1370+ if (uri .getUserInfo () == null ) {
1371+ return rawUrlString ;
1372+ } else {
1373+ final URI stripped =
1374+ new URI (
1375+ uri .getScheme (),
1376+ null ,
1377+ uri .getHost (),
1378+ uri .getPort (),
1379+ uri .getPath (),
1380+ uri .getQuery (),
1381+ uri .getFragment ());
1382+ return stripped .toASCIIString ();
1383+ }
1384+ } catch (NullPointerException | URISyntaxException e ) {
1385+ throw new RuntimeException (e );
1386+ }
13661387 }
13671388 });
13681389 }
You can’t perform that action at this time.
0 commit comments