Skip to content

Commit

Permalink
Fix glob resolution for remove files
Browse files Browse the repository at this point in the history
Signed-off-by: Paolo Di Tommaso <[email protected]>
  • Loading branch information
pditommaso committed Jul 31, 2023
1 parent f2a2ea3 commit 19a72c4
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
4 changes: 3 additions & 1 deletion modules/nextflow/src/main/groovy/nextflow/Nextflow.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package nextflow

import static nextflow.file.FileHelper.*

import java.nio.file.FileSystem
import java.nio.file.Files
import java.nio.file.NoSuchFileException
import java.nio.file.Path
Expand Down Expand Up @@ -60,7 +61,8 @@ class Nextflow {
static private fileNamePattern( FilePatternSplitter splitter, Map opts ) {

final scheme = splitter.scheme
final folder = toCanonicalPath(splitter.parent)
final target = scheme ? "$scheme://$splitter.parent" : splitter.parent
final folder = toCanonicalPath(target)
final pattern = splitter.fileName

if( opts == null ) opts = [:]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,8 @@ class FilePatternSplitterTest extends Specification {
'test/data/file[a-b]' | 'test/data/' | 'file[a-b]' | null
'test/data[a-b]/file' | 'test/' | 'data[a-b]/file' | null
'/some/path\\[a-b\\]/data{a,b}/file\\?' | '/some/path[a-b]/'| 'data{a,b}/file\\?' | null

's3://foo/bar/*' | 'foo/bar/' | '*' | 's3'
's3://foo/bar/file.txt' | 'foo/bar/' | 'file.txt' | 's3'
}

def 'should strip glob escape chars' () {
Expand Down
11 changes: 11 additions & 0 deletions plugins/nf-amazon/src/test/nextflow/S3NextflowTest.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ package nextflow

import java.nio.file.Paths

import spock.lang.IgnoreIf
import spock.lang.Requires
import spock.lang.Specification
/**
*
Expand Down Expand Up @@ -46,4 +48,13 @@ class S3NextflowTest extends Specification {
SysEnv.pop()
}

@IgnoreIf({System.getenv('NXF_SMOKE')})
@Requires({System.getenv('AWS_S3FS_ACCESS_KEY') && System.getenv('AWS_S3FS_SECRET_KEY')})
def 'should resolve list of files' () {
when:
def result = Nextflow.files('s3://ngi-igenomes/*')
then:
result.size() == 3
}

}

0 comments on commit 19a72c4

Please sign in to comment.