-
Notifications
You must be signed in to change notification settings - Fork 638
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix normalization of consecutive slashes in uri path (#5114)
Signed-off-by: Paolo Di Tommaso <[email protected]>
- Loading branch information
1 parent
4c207c2
commit 3f366b7
Showing
6 changed files
with
158 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,14 +22,12 @@ import java.nio.file.Path | |
import java.nio.file.Paths | ||
|
||
import com.google.cloud.storage.contrib.nio.CloudStorageFileSystem | ||
import nextflow.Global | ||
import nextflow.Session | ||
import nextflow.SysEnv | ||
import spock.lang.Ignore | ||
import spock.lang.Specification | ||
|
||
import nextflow.Global | ||
import nextflow.Session | ||
import spock.lang.Unroll | ||
|
||
/** | ||
* | ||
* @author Paolo Di Tommaso <[email protected]> | ||
|
@@ -128,4 +126,31 @@ class FileHelperGsTest extends Specification { | |
'/file.txt' | '/file.txt' | ||
Path.of('/file.txt') | '/file.txt' | ||
} | ||
|
||
def 'should convert to a canonical path' () { | ||
given: | ||
Global.session = Mock(Session) { getConfig() >> [google:[project:'foo', region:'x']] } | ||
|
||
expect: | ||
FileHelper.toCanonicalPath(VALUE).toUri() == EXPECTED | ||
|
||
where: | ||
VALUE | EXPECTED | ||
'gs://foo/some/file.txt' | new URI('gs://foo/some/file.txt') | ||
'gs://foo/some///file.txt' | new URI('gs://foo/some/file.txt') | ||
} | ||
|
||
@Unroll | ||
def 'should remove consecutive slashes in the path' () { | ||
given: | ||
Global.session = Mock(Session) { getConfig() >> [google:[project:'foo', region:'x']] } | ||
|
||
expect: | ||
FileHelper.asPath(STR).toUri() == EXPECTED | ||
where: | ||
STR | EXPECTED | ||
'gs://foo//this/that' | new URI('gs://foo/this/that') | ||
'gs://foo//this///that' | new URI('gs://foo/this/that') | ||
} | ||
|
||
} |