Skip to content

Phase 1: force BIDS filenames on data.nemar.org downloads (#513) - #515

Merged
neuromechanist merged 3 commits into
feature/issue-514-epic-website-followupsfrom
feature/issue-513-phase1-bids-filenames
May 16, 2026
Merged

neuromechanist merged 3 commits into
feature/issue-514-epic-website-followupsfrom
feature/issue-513-phase1-bids-filenames

Conversation

@neuromechanist

Copy link
Copy Markdown
Contributor

Closes #513. Phase 1 of epic #514.

Summary

  • Annex-keyed presigned URLs now carry response-content-disposition=attachment;filename="<bids-basename>" so S3 returns the BIDS-shaped filename in Content-Disposition on the actual GET.
  • New helper buildContentDisposition() in data-router.ts produces an RFC 6266 value with both an ASCII filename= (sanitised for quoted-string) and an RFC 5987 filename*=UTF-8''... extension for Unicode names.
  • The disposition emits with no inter-token whitespace; aws4fetch round-trips through URLSearchParams which form-encodes space as +, and omitting whitespace dodges the + vs %20 ambiguity entirely while still being valid per RFC 6266 (OWS is optional).
  • git: branch is unchanged: raw.githubusercontent.com already serves with the BIDS basename because the URL path ends with it.

Test plan

  • bun test test/data-route.unit.test.ts → 105 pass / 0 fail
  • tsc --noEmit in backend passes
  • After deploy: curl -sIL "https://data.nemar.org/nm000104/v2.0.0/sub-01438774/ses-1625258895/emg/sub-01438774_ses-1625258895_task-typing_emg.bdf" | grep -i content-disposition returns attachment;filename="sub-01438774_..._emg.bdf"
  • After deploy: rclone copy :http:data.nemar.org/nm000104/v2.0.0/ ./ produces BIDS-shaped filenames

Notes

Annex-keyed presigned URLs now carry response-content-disposition with the BIDS basename so browsers, rclone, aria2c and curl save SHA256E-...bdf as sub-XX_task-Y_emg.bdf. RFC 6266 attachment value carries both an ASCII filename= (sanitised for the quoted-string) and an RFC 5987 filename*=UTF-8'' extension for non-ASCII names. Disposition emits with no inter-token whitespace so the value survives aws4fetch's URLSearchParams round-trip (form-encoded + vs %20) intact.
@github-actions

github-actions Bot commented May 16, 2026 •

Copy link
Copy Markdown

📦 Package Preview

Your package is ready to test!

bun install -g nemar-cli@PR515

Version: 0.8.18-PR515.6ae29d3
Commit: 6ae29d3


🤖 Updated on each push.

Apply Phase 1 code-reviewer feedback on PR #515: explain why response-content-disposition must be URL-encoded before signing (escape ;=&# from breaking URL parsing), add a regression test for top-level annex bidsPath, and pin that response-content-disposition appears before X-Amz-Signature so a future refactor that appends after signing fails loudly.
@neuromechanist
neuromechanist merged commit a1e0f50 into feature/issue-514-epic-website-followups May 16, 2026
1 check passed
@neuromechanist
neuromechanist deleted the feature/issue-513-phase1-bids-filenames branch May 18, 2026 11:10

This branch was previously deployed

1 inactive deployment
npm — 6ae29d38 Deployed May 16, 2026 by neuromechanist via publish #934
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