Skip to content

Commit

Permalink
fix for remote uris
Browse files Browse the repository at this point in the history
The check if in a derivatives folder was not working when the root had a
uri prefix. This fixes it so the uri prefix is stripped off for the
check.
  • Loading branch information
akhanf committed Oct 26, 2024
1 parent 76b057a commit 07bdfcd
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions bids/layout/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,11 +187,11 @@ def _validate_file(self, f):
return self.validator.is_bids(to_check)

def _index_dir(self, path, config, force=None):

abs_path = self._layout._root / path
root_path = Path(self._layout._root.path) # drops the uri prefix if it is there
abs_path = root_path / Path(path.path).relative_to(root_path)

# Derivative directories must always be added separately
if self._layout._root.joinpath('derivatives') in abs_path.parents:
if root_path.joinpath('derivatives') in abs_path.parents:
return [], []

config = list(config) # Shallow copy
Expand All @@ -212,6 +212,7 @@ def _index_dir(self, path, config, force=None):
# Get lists of 1st-level subdirectories and files in the path directory
_, dirnames, filenames = next(path.fs.walk(path.path))


# Symbolic links are returned as filenames even if they point to directories
# Temporary list to store symbolic links that need to be removed from filenames
links_to_dirs = []
Expand Down

0 comments on commit 07bdfcd

Please sign in to comment.