Fix publish error when remote path contains double slash #5112
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
GCP doesn't accept paths that contain a double slash. Apparently this has been the case for a while, but we didn't realize it because publish errors were being ignored by default. Until recently when we made publish errors fatal.
The root cause appears to be that
FileHelper.toCanonicalPath()
does not normalize the path when it is remote. You can verify using this test case:Output:
This will fix the specific issue with PublishDir, but long-term we should probably review the various ways in which strings are converted to paths across the codebase (which there are several) and try to use a uniform approach. The approach I used in this PR seems to be the most common one and the most robust.
See also: nextflow-io/nf-prov#34