File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -88,6 +88,7 @@ class GitlabRepositoryProvider extends RepositoryProvider {
8888 // https://docs.gitlab.com/ee/api/repository_files.html#get-raw-file-from-repository
8989 //
9090 final ref = revision ?: getDefaultBranch()
91+ path = path. replaceAll(" ^/+" , " " ) // leading slashes cause 400s with GitLab
9192 final encodedPath = URLEncoder . encode(path,' utf-8' )
9293 return " ${ config.endpoint} /api/v4/projects/${ getProjectName()} /repository/files/${ encodedPath} ?ref=${ ref} "
9394 }
Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ package nextflow.scm
1919import spock.lang.IgnoreIf
2020import spock.lang.Requires
2121import spock.lang.Specification
22+ import spock.lang.Unroll
2223
2324/**
2425 *
@@ -50,16 +51,20 @@ class GitlabRepositoryProviderTest extends Specification {
5051 }
5152
5253 @Requires ({System .getenv(' NXF_GITLAB_ACCESS_TOKEN' )})
53- def ' should read file content' () {
54+ @Unroll
55+ def ' should read file content: #contentURL' () {
5456 given :
5557 def token = System . getenv(' NXF_GITLAB_ACCESS_TOKEN' )
5658 def config = new ProviderConfig (' gitlab' ). setAuth(token)
5759
5860 when :
5961 def repo = new GitlabRepositoryProvider (' pditommaso/hello' , config)
60- def result = repo. readText(' main.nf ' )
62+ def result = repo. readText(contentURL )
6163 then :
6264 result. trim(). startsWith(' #!/usr/bin/env nextflow' )
65+ where :
66+ contentURL << [' main.nf' , ' /main.nf' ]
67+
6368 }
6469
6570 @Requires ({System .getenv(' NXF_GITLAB_ACCESS_TOKEN' )})
You can’t perform that action at this time.
0 commit comments