Skip to content

Commit

Permalink
Directories: Fix the issue with the directory validation not handling… (
Browse files Browse the repository at this point in the history
#1286)

* Directories: Fix the issue with the directory validation not handling empty directories appropriately.

* General: Update CHANGELOG

---------

Co-authored-by: Juan Puerto <=>
  • Loading branch information
jpuerto-psc authored Jan 19, 2024
1 parent 1f412a6 commit 8fd61e3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
- Update CEDAR links for PhenoCycler & Histology
- Refactor Upload to avoid validating the same contributors.tsv multiple times / running plugins over files multiple times
- Add entry for segmentation-mask
- Modify directory schema validation such that it takes empty directories into account


## v0.0.16

Expand Down
11 changes: 8 additions & 3 deletions src/ingest_validation_tools/directory_validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,14 @@ def validate_directory(
if os.name == "nt":
# Convert MS backslashes to forward slashes.
prefix = prefix.replace("\\", "/")
actual_paths += (
[f"{prefix}/{name}" for name in file_names] if prefix else file_names
)
# If this is not the root of the path and is a leaf directory
if not file_names and prefix:
actual_paths += [f"{prefix}/"]
# Otherwise this should be a branch directory
else:
actual_paths += (
[f"{prefix}/{name}" for name in file_names] if prefix else file_names
)

"""TODO: message_munger adds periods at the end of these messages
which is very confusing for regex! Also human readability of required_patterns
Expand Down

0 comments on commit 8fd61e3

Please sign in to comment.