Apply permanetn `ref` query param to the GitLab raw file location request (#545)
A user claims that he couldn't start a workspace form GitLab repository because of the raw file location request doesn't contain the ref query parameter. Rework the way of generating the GitLab raw file location function to permanently add the ref query param.pull/553/head
parent
da5174bf17
commit
6edfa3910f
|
|
@ -178,11 +178,8 @@ public class GitlabUrl extends DefaultFactoryUrl {
|
|||
.add("repository")
|
||||
.add("files")
|
||||
.add(encode(fileName, Charsets.UTF_8))
|
||||
.add("raw")
|
||||
.add("raw?ref=" + (isNullOrEmpty(branch) ? "HEAD" : branch))
|
||||
.toString();
|
||||
if (branch != null) {
|
||||
resultUrl = resultUrl + "?ref=" + branch;
|
||||
}
|
||||
|
||||
return resultUrl;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ public class GitlabAuthorizingFileContentProviderTest {
|
|||
verify(urlFetcher)
|
||||
.fetch(
|
||||
eq(
|
||||
"https://gitlab.net/api/v4/projects/eclipse%2Fche/repository/files/devfile.yaml/raw"),
|
||||
"https://gitlab.net/api/v4/projects/eclipse%2Fche/repository/files/devfile.yaml/raw?ref=HEAD"),
|
||||
eq("Bearer my-token"));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -80,11 +80,11 @@ public class GitlabUrlTest {
|
|||
return new Object[][] {
|
||||
{
|
||||
"https://gitlab.net/eclipse/che.git",
|
||||
"https://gitlab.net/api/v4/projects/eclipse%%2Fche/repository/files/%s/raw"
|
||||
"https://gitlab.net/api/v4/projects/eclipse%%2Fche/repository/files/%s/raw?ref=HEAD"
|
||||
},
|
||||
{
|
||||
"https://gitlab.net/eclipse/fooproj/che.git",
|
||||
"https://gitlab.net/api/v4/projects/eclipse%%2Ffooproj%%2Fche/repository/files/%s/raw"
|
||||
"https://gitlab.net/api/v4/projects/eclipse%%2Ffooproj%%2Fche/repository/files/%s/raw?ref=HEAD"
|
||||
},
|
||||
{
|
||||
"git@gitlab.net:eclipse/che.git",
|
||||
|
|
|
|||
Loading…
Reference in New Issue