fix: Support BitBucket endpoint with path (#665)
Signed-off-by: Anatolii Bazko <abazko@redhat.com>pull/669/head
parent
6cdf6f655a
commit
28002fb835
|
|
@ -78,7 +78,7 @@ public class BitbucketServerURLParser {
|
||||||
bitbucketUrlPatternTemplates.forEach(
|
bitbucketUrlPatternTemplates.forEach(
|
||||||
t -> {
|
t -> {
|
||||||
String scheme = t.contains("git@") ? "ssh" : uri.getScheme();
|
String scheme = t.contains("git@") ? "ssh" : uri.getScheme();
|
||||||
String host = uri.getHost();
|
String host = uri.getHost() + uri.getPath();
|
||||||
bitbucketUrlPatterns.add(Pattern.compile(format(t, scheme, host)));
|
bitbucketUrlPatterns.add(Pattern.compile(format(t, scheme, host)));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2012-2023 Red Hat, Inc.
|
* Copyright (c) 2012-2024 Red Hat, Inc.
|
||||||
* This program and the accompanying materials are made
|
* This program and the accompanying materials are made
|
||||||
* available under the terms of the Eclipse Public License 2.0
|
* available under the terms of the Eclipse Public License 2.0
|
||||||
* which is available at https://www.eclipse.org/legal/epl-2.0/
|
* which is available at https://www.eclipse.org/legal/epl-2.0/
|
||||||
|
|
@ -59,7 +59,7 @@ public class BitbucketServerURLParserTest {
|
||||||
public void setUp() {
|
public void setUp() {
|
||||||
bitbucketURLParser =
|
bitbucketURLParser =
|
||||||
new BitbucketServerURLParser(
|
new BitbucketServerURLParser(
|
||||||
"https://bitbucket.2mcl.com,https://bbkt.com",
|
"https://bitbucket.2mcl.com,https://bbkt.com,https://my-bitbucket.org/bitbucket",
|
||||||
devfileFilenamesProvider,
|
devfileFilenamesProvider,
|
||||||
oAuthAPI,
|
oAuthAPI,
|
||||||
mock(PersonalAccessTokenManager.class));
|
mock(PersonalAccessTokenManager.class));
|
||||||
|
|
@ -145,6 +145,7 @@ public class BitbucketServerURLParserTest {
|
||||||
@DataProvider(name = "UrlsProvider")
|
@DataProvider(name = "UrlsProvider")
|
||||||
public Object[][] urls() {
|
public Object[][] urls() {
|
||||||
return new Object[][] {
|
return new Object[][] {
|
||||||
|
{"https://my-bitbucket.org/bitbucket/scm/proj/repo.git"},
|
||||||
{"https://bitbucket.2mcl.com/scm/~user/repo.git"},
|
{"https://bitbucket.2mcl.com/scm/~user/repo.git"},
|
||||||
{"https://bitbucket.2mcl.com/scm/project/test1.git"},
|
{"https://bitbucket.2mcl.com/scm/project/test1.git"},
|
||||||
{"https://bitbucket.2mcl.com/projects/project/repos/test1/browse?at=refs%2Fheads%2Fbranch"},
|
{"https://bitbucket.2mcl.com/projects/project/repos/test1/browse?at=refs%2Fheads%2Fbranch"},
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue