Skip to content

fix: Download of binary DICOM and study index writes wrong files#127

Open
wayfarer3130 wants to merge 4 commits into
masterfrom
fix/deploy-args-and-util-require
Open

fix: Download of binary DICOM and study index writes wrong files#127
wayfarer3130 wants to merge 4 commits into
masterfrom
fix/deploy-args-and-util-require

Conversation

@wayfarer3130

Copy link
Copy Markdown
Collaborator

The download of full studies from S3 fails because it doesn't download the correct names for a variety of files, including the study index and binary segmentation part 10 files.
As well, the index re-creation also fails due to mixed import/require options.

wayfarer3130 and others added 4 commits July 9, 2026 14:44
…er bun

- Declare <studyUIDs...> as a required positional on the studies command so
  commander reports a missing-argument error instead of exiting silently
  (previously the variadic -d option could swallow the study UID, leaving
  the command with no arguments and studiesMain returned without a message).
- Import uids via its subpath in static-wado-creator index.mjs; mixing an
  ESM import of the static-wado-util package root with the CJS require()
  calls elsewhere in the package made bun treat the root as an async module
  and fail with "require() async module is unsupported".

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
On upload, fileToKey strips "/index.json.gz" so the study singleton index
is stored at the S3 key "studies/<uid>". On retrieve, contentItemToFileName
had no reverse mapping for that key shape and fell through to
"studies/<uid>.gz", so the study index never landed at
studies/<uid>/index.json.gz and mkdicomweb index could not add the study
to the overall studies index.

dir() now detects directory-style index objects generically: any listed
key that also has child keys maps back to <key>/index.json.gz. This covers
the study singleton, the overall studies index, and instance-level query
indexes, without hardcoding path names.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
fileToKey strips the .mht extension on upload, so multipart objects live
at extension-less keys (frames/1, bulkdata/xx/yy/zzzz). The directory
listing can only guess "<key>.gz" for those, which stored retrieved
frames as 1.gz instead of 1.mht / 1.mht.gz.

- S3Ops.retrieve now corrects the destination name from the object's
  ContentType/ContentEncoding: multipart/related objects are written as
  <key>.mht, or <key>.mht.gz when gzip encoded.
- S3Ops.localCandidates lists the possible local names for a listed
  object so DeployGroup.retrieve can recognize already-retrieved .mht
  files and skip re-downloading them.
- DeployGroup renames files stored under the generic ".gz" name by older
  retrieves to their correct multipart name, sniffing the leading bytes
  (multipart boundary, or gzip whose content starts with a boundary) so
  gzipped JSON like metadata.gz is left alone. Skipped on --dry-run.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@wayfarer3130 wayfarer3130 requested a review from rleisti July 9, 2026 21:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant