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 15
15
import static se .bjurr .prnfb .service .RepoProtocol .http ;
16
16
import static se .bjurr .prnfb .service .RepoProtocol .ssh ;
17
17
18
+ import java .net .URI ;
19
+ import java .net .URISyntaxException ;
18
20
import java .util .Collections ;
19
21
import java .util .Iterator ;
20
22
import java .util .List ;
@@ -1362,7 +1364,26 @@ public String perform() throws RuntimeException {
1362
1364
if (allUrls .isEmpty ()) {
1363
1365
return "" ;
1364
1366
}
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
+ }
1366
1387
}
1367
1388
});
1368
1389
}
You can’t perform that action at this time.
0 commit comments