From 7d92d957df9c2c27de468842cd084be534102f15 Mon Sep 17 00:00:00 2001 From: mirpedrol Date: Tue, 10 Oct 2023 14:24:28 +0200 Subject: [PATCH] Do not check S3 URL paths with PathValidator FilePathValidator and DirectoryPathValidator --- CHANGELOG.md | 6 ++++++ .../FormatValidators/DirectoryPathValidator.groovy | 6 ++++++ .../validation/FormatValidators/FilePathValidator.groovy | 6 ++++++ .../validation/FormatValidators/PathValidator.groovy | 6 ++++++ 4 files changed, 24 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index fecc595..28be793 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # nextflow-io/nf-validation: Changelog +# Version 0.3.4 (dev) + +### Bug fixes + +- Do not check S3 URL paths with `PathValidator` `FilePathValidator` and `DirectoryPathValidator` ([#105](https://github.com/nextflow-io/nf-validation/pull/105)) + # Version 0.3.3 ### Bug fixes diff --git a/plugins/nf-validation/src/main/nextflow/validation/FormatValidators/DirectoryPathValidator.groovy b/plugins/nf-validation/src/main/nextflow/validation/FormatValidators/DirectoryPathValidator.groovy index ffa52be..0d935b5 100644 --- a/plugins/nf-validation/src/main/nextflow/validation/FormatValidators/DirectoryPathValidator.groovy +++ b/plugins/nf-validation/src/main/nextflow/validation/FormatValidators/DirectoryPathValidator.groovy @@ -1,14 +1,20 @@ package nextflow.validation import java.nio.file.Path +import groovy.util.logging.Slf4j import org.everit.json.schema.FormatValidator import nextflow.Nextflow +@Slf4j public class DirectoryPathValidator implements FormatValidator { @Override public Optional validate(final String subject) { + if (subject.startsWith('s3://')) { + log.debug("S3 paths are not supported by 'DirectoryPathValidator': '${subject}'") + return Optional.empty() + } Path file = Nextflow.file(subject) as Path if (file.exists() && !file.isDirectory()) { return Optional.of("'${subject}' is not a directory, but a file" as String) diff --git a/plugins/nf-validation/src/main/nextflow/validation/FormatValidators/FilePathValidator.groovy b/plugins/nf-validation/src/main/nextflow/validation/FormatValidators/FilePathValidator.groovy index a105c68..a49ec6c 100644 --- a/plugins/nf-validation/src/main/nextflow/validation/FormatValidators/FilePathValidator.groovy +++ b/plugins/nf-validation/src/main/nextflow/validation/FormatValidators/FilePathValidator.groovy @@ -1,14 +1,20 @@ package nextflow.validation import java.nio.file.Path +import groovy.util.logging.Slf4j import org.everit.json.schema.FormatValidator import nextflow.Nextflow +@Slf4j public class FilePathValidator implements FormatValidator { @Override public Optional validate(final String subject) { + if (subject.startsWith('s3://')) { + log.debug("S3 paths are not supported by 'FilePathValidator': '${subject}'") + return Optional.empty() + } Path file = Nextflow.file(subject) as Path if (file.isDirectory()) { return Optional.of("'${subject}' is not a file, but a directory" as String) diff --git a/plugins/nf-validation/src/main/nextflow/validation/FormatValidators/PathValidator.groovy b/plugins/nf-validation/src/main/nextflow/validation/FormatValidators/PathValidator.groovy index dcbd826..afe82e0 100644 --- a/plugins/nf-validation/src/main/nextflow/validation/FormatValidators/PathValidator.groovy +++ b/plugins/nf-validation/src/main/nextflow/validation/FormatValidators/PathValidator.groovy @@ -1,14 +1,20 @@ package nextflow.validation import java.nio.file.Path +import groovy.util.logging.Slf4j import org.everit.json.schema.FormatValidator import nextflow.Nextflow +@Slf4j public class PathValidator implements FormatValidator { @Override public Optional validate(final String subject) { + if (subject.startsWith('s3://')) { + log.debug("S3 paths are not supported by 'PathValidator': '${subject}'") + return Optional.empty() + } Path file = Nextflow.file(subject) as Path return Optional.empty() }