Skip to content

Allow spaces in directory paths #3552

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from

Conversation

robsyme
Copy link
Contributor

@robsyme robsyme commented Apr 29, 2025

Currently, nf-core pipelines disallow spaces in directory paths, which unnecessarily limits usability. If users inherit datasets with spaces in the path (e.g., from external collaborators or legacy systems), they may be unable to run the pipeline without renaming files — a non-trivial operation, especially with object storage.

Nextflow stages inputs into isolated work directories, so spaces in source paths have no impact on tool execution. We continue to disallow spaces in filenames themselves to avoid downstream issues.

Allowing spaces in directory paths improves flexibility without compromising workflow robustness. Renaming paths is not always feasible (e.g., on object storage where renaming is non-atomic) and can break integrations with other systems.

By default, we dissallow spaces in directory paths, which is an unnecessary limitation.
@robsyme robsyme changed the base branch from main to dev April 29, 2025 17:20
@nf-core nf-core deleted a comment from github-actions bot Apr 29, 2025
@robsyme
Copy link
Contributor Author

robsyme commented Apr 29, 2025

Example snippet (run nextflow console to check) that checks the regular expression matching:

// Define the regex as a plain string (with double backslashes!)
def regexString = "^([\\S\\s]*\\/)?[^\\s\\/]+\\.f(ast)?q\\.gz$"

// Compile the regex string into a Pattern
def regex = Pattern.compile(regexString)

// Example list of paths
def paths = [
    "s3://path/to some/reads/RD-172.fastq.gz",   // valid
    "reads.fq.gz",                               // valid
    "reads.fastq.gz",                            // valid
    "path/reads.fastq.gz",                       // valid
    "path with space/reads.fastq.gz",            // valid
    "path/to some/reads.fq.gz",                  // valid
    "path/reads .fastq.gz",                      // invalid (space in filename)
    "path/reads.fastq",                          // invalid (missing .gz)
    "reads.fastq .gz"                            // invalid (space in filename)
]

// Validate each path
paths.each { path ->
    if (regex.matcher(path).matches()) {
        println "VALID:   $path"
    } else {
        println "INVALID: $path"
    }
}

Copy link

codecov bot commented Apr 29, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 76.47%. Comparing base (59f8aff) to head (01c091d).
Report is 1 commits behind head on dev.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@maxulysse
Copy link
Member

As seen in nf-core/rnafusion#659

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants