|
18 | 18 | package pl.project13.maven.git; |
19 | 19 |
|
20 | 20 | import com.google.errorprone.annotations.CanIgnoreReturnValue; |
21 | | -import org.apache.http.client.utils.URIBuilder; |
22 | 21 | import pl.project13.maven.git.build.BuildServerDataProvider; |
23 | 22 | import pl.project13.maven.git.build.UnknownBuildServerData; |
24 | 23 | import pl.project13.maven.git.log.LoggerBridge; |
@@ -53,7 +52,7 @@ public abstract class GitDataProvider implements GitProvider { |
53 | 52 | protected CommitIdGenerationMode commitIdGenerationMode; |
54 | 53 |
|
55 | 54 | protected String evaluateOnCommit; |
56 | | - |
| 55 | + |
57 | 56 | protected boolean useBranchNameFromBuildEnvironment; |
58 | 57 |
|
59 | 58 | protected List<String> excludeProperties; |
@@ -95,7 +94,7 @@ public GitDataProvider setDateFormatTimeZone(String dateFormatTimeZone) { |
95 | 94 | this.dateFormatTimeZone = dateFormatTimeZone; |
96 | 95 | return this; |
97 | 96 | } |
98 | | - |
| 97 | + |
99 | 98 | public GitDataProvider setUseBranchNameFromBuildEnvironment(boolean useBranchNameFromBuildEnvironment) { |
100 | 99 | this.useBranchNameFromBuildEnvironment = useBranchNameFromBuildEnvironment; |
101 | 100 | return this; |
@@ -309,13 +308,18 @@ protected String stripCredentialsFromOriginUrl(String gitRemoteString) throws Gi |
309 | 308 | if (null == userInfoString) { |
310 | 309 | return gitRemoteString; |
311 | 310 | } |
312 | | - URIBuilder b = new URIBuilder(gitRemoteString); |
| 311 | + |
313 | 312 | String[] userInfo = userInfoString.split(":"); |
314 | 313 | // Build a new URL from the original URL, but nulling out the password |
315 | 314 | // component of the userinfo. We keep the username so that ssh uris such |
316 | 315 | // ssh://git@github.com will retain 'git@'. |
317 | | - b.setUserInfo(userInfo[0]); |
318 | | - return b.build().toString(); |
| 316 | + return new URI(original.getScheme(), |
| 317 | + userInfo[0], |
| 318 | + original.getHost(), |
| 319 | + original.getPort(), |
| 320 | + original.getPath(), |
| 321 | + original.getQuery(), |
| 322 | + original.getFragment()).toString(); |
319 | 323 |
|
320 | 324 | } catch (URISyntaxException e) { |
321 | 325 | log.error("Something went wrong to strip the credentials from git's remote url (please report this)!", e); |
|
0 commit comments