Skip to content
This repository has been archived by the owner on Aug 20, 2024. It is now read-only.

Commit

Permalink
Do not check S3 URL paths with PathValidator FilePathValidator and Di…
Browse files Browse the repository at this point in the history
…rectoryPathValidator
  • Loading branch information
mirpedrol committed Oct 10, 2023
1 parent 3712e1d commit 7d92d95
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 0 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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<String> 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)
Expand Down
Original file line number Diff line number Diff line change
@@ -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<String> 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)
Expand Down
Original file line number Diff line number Diff line change
@@ -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<String> 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()
}
Expand Down

0 comments on commit 7d92d95

Please sign in to comment.