Skip to content

Commit

Permalink
Merge pull request #1370 from girder/harden-dicom-local-path
Browse files Browse the repository at this point in the history
Improve handling dicom files in the working directory
  • Loading branch information
manthey authored Nov 10, 2023
2 parents 5d54198 + 274d59f commit 799f653
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
- Configurable item list grid view ([#1363](../../pull/1363))
- Allow labels in item list view ([#1366](../../pull/1366))
- Improve cache key guard ([#1368](../../pull/1368))
- Improve handling dicom files in the working directory ([#1370](../../pull/137068))

### Bug Fixes
- Default to "None" for the DICOM assetstore limit ([#1359](../../pull/1359))
Expand Down
5 changes: 3 additions & 2 deletions sources/dicom/large_image_source_dicom/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,12 +127,13 @@ def __init__(self, path, **kwargs):
path = str(path)
if not os.path.isfile(path):
raise TileSourceFileNotFoundError(path) from None
root = os.path.dirname(path)
root = os.path.dirname(path) or '.'
self._largeImagePath = [
os.path.join(root, entry) for entry in os.listdir(root)
if os.path.isfile(os.path.join(root, entry)) and
self._pathMightBeDicom(entry)]
if path not in self._largeImagePath:
if (path not in self._largeImagePath and
os.path.join(root, os.path.basename(path)) not in self._largeImagePath):
self._largeImagePath = [path]
else:
self._largeImagePath = path
Expand Down

0 comments on commit 799f653

Please sign in to comment.