File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -183,12 +183,35 @@ final class AzureRepositoryProvider extends RepositoryProvider {
183183 " ${ config.server} /${ urlPath} "
184184 }
185185
186- /* * {@inheritDoc} */
187186 @Override
188- byte [] readBytes ( String path ) {
187+ String readText ( String path ) {
189188 final url = getContentUrl(path)
190189 final response = invokeAndParseResponse(url)
191- return response. get(' content' )?. toString()?. getBytes()
190+ return response. get(' content' )?. toString()
191+ }
192+
193+ /* * {@inheritDoc} */
194+ @Override
195+ byte [] readBytes (String path ) {
196+ // For binary content, use direct download instead of JSON embedding
197+ final queryParams = [
198+ ' download' : true ,
199+ ' includeContent' : false ,
200+ ' includeContentMetadata' : false ,
201+ " api-version" : 6.0 ,
202+ ' path' : path
203+ ] as Map<String ,Object >
204+
205+ if ( revision ) {
206+ queryParams[' versionDescriptor.version' ] = revision
207+ if ( COMMIT_REGEX . matcher(revision). matches() )
208+ queryParams[' versionDescriptor.versionType' ] = ' commit'
209+ }
210+
211+ final queryString = queryParams. collect({ " $it . key =$it . value " }). join(' &' )
212+ final url = " $endpointUrl /items?$queryString "
213+ // Use invokeBytes for direct binary content download
214+ return invokeBytes(url)
192215 }
193216
194217}
Original file line number Diff line number Diff line change @@ -24,6 +24,7 @@ import nextflow.extension.FilesEx
2424import nextflow.plugin.Plugins
2525import nextflow.secret.SecretsLoader
2626import spock.lang.IgnoreIf
27+ import spock.lang.Requires
2728import spock.lang.Specification
2829/**
2930 *
@@ -384,10 +385,12 @@ class CmdConfigTest extends Specification {
384385
385386 }
386387
387-
388388 @IgnoreIf ({System .getenv(' NXF_SMOKE' )})
389+ @Requires ({System .getenv(' NXF_GITHUB_ACCESS_TOKEN' )})
389390 def ' should resolve remote config' () {
390391 given :
392+ SysEnv . push(GITHUB_TOKEN : System . getenv(' NXF_GITHUB_ACCESS_TOKEN' ))
393+ and :
391394 def buffer = new ByteArrayOutputStream ()
392395 def cmd = new CmdConfig (
393396 args : [' https://github.com/nextflow-io/hello' ],
@@ -404,6 +407,9 @@ class CmdConfigTest extends Specification {
404407 }
405408 '''
406409 .stripIndent()
410+
411+ cleanup :
412+ SysEnv . pop()
407413 }
408414
409415 @IgnoreIf ({System .getenv(' NXF_SMOKE' )})
Original file line number Diff line number Diff line change @@ -20,10 +20,6 @@ import nextflow.exception.AbortOperationException
2020import spock.lang.IgnoreIf
2121import spock.lang.Requires
2222import spock.lang.Specification
23-
24- import javax.imageio.ImageIO
25- import javax.imageio.stream.MemoryCacheImageInputStream
26-
2723/**
2824 *
2925 * @author Tobias Neumann <tobias.neumann.at@gmail.com>
@@ -153,11 +149,7 @@ class AzureRepositoryProviderTest extends Specification {
153149
154150 then :
155151 result. length == 22915
156- and :
157- def inputStream = new ByteArrayInputStream (result)
158- def imageInput = new MemoryCacheImageInputStream (inputStream)
159- final readers = ImageIO . getImageReaders(imageInput)
160- readers. hasNext()
152+ result. sha256() == ' 7a396344498750f614155f6e4f38b7d6ca98ced45daf0921b64acf73b18efaf4'
161153 }
162154
163155
Original file line number Diff line number Diff line change @@ -19,10 +19,6 @@ package nextflow.scm
1919import spock.lang.IgnoreIf
2020import spock.lang.Requires
2121import spock.lang.Specification
22-
23- import javax.imageio.ImageIO
24- import javax.imageio.stream.MemoryCacheImageInputStream
25-
2622/**
2723 *
2824 * @author Akira Sekiguchi <pachiras.yokohama@gmail.com>
@@ -112,20 +108,18 @@ class GiteaRepositoryProviderTest extends Specification {
112108
113109
114110 @IgnoreIf ({System .getenv(' NXF_SMOKE' )})
115- @Requires ({System .getenv(' NXF_AZURE_REPOS_TOKEN ' )})
111+ @Requires ({System .getenv(' NXF_GITEA_ACCESS_TOKEN ' )})
116112 def ' should read bytes file content' () {
117113 given :
118114 def token = System . getenv(' NXF_GITEA_ACCESS_TOKEN' )
119115 def config = new ProviderConfig (' gitea' , new ConfigSlurper (). parse(CONFIG ). providers. mygitea as ConfigObject ). setAuth(token)
120116
121117 when :
122- def repo = new GiteaRepositoryProvider (' swingingsimiangitea/rnaseq ' , config)
118+ def repo = new GiteaRepositoryProvider (' pditommaso/test-hello ' , config)
123119 def result = repo. readBytes(' docs/images/nf-core-rnaseq_logo_light.png' )
124120
125121 then :
126- def inputStream = new ByteArrayInputStream (result)
127- def imageInput = new MemoryCacheImageInputStream (inputStream)
128- final readers = ImageIO . getImageReaders(imageInput)
129- readers. hasNext()
122+ result. length == 22915
123+ result. sha256() == ' 7a396344498750f614155f6e4f38b7d6ca98ced45daf0921b64acf73b18efaf4'
130124 }
131125}
You can’t perform that action at this time.
0 commit comments