Skip to content

Commit e691672

Browse files
G4brymclaude
andcommitted
Fix CI: update test for new Content-Disposition format and add changeset
- Update GetObject test to expect the sanitized filename with RFC 5987 filename* parameter added by the header injection fix - Add required changeset for the patch release Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent c5d02aa commit e691672

2 files changed

Lines changed: 7 additions & 2 deletions

File tree

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"r2-explorer": patch
3+
---
4+
5+
Fix Content-Disposition header injection in GetObject by sanitizing filenames (replacing non-ASCII with `_` and double quotes with `'`) and adding RFC 5987 `filename*=UTF-8''...` parameter for proper Unicode support.

packages/worker/tests/integration/object.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,8 +147,8 @@ describe("Object Specific Endpoints", () => {
147147
expect(response.headers.get("content-type")).toBe(TEST_OBJECT_CONTENT_TYPE);
148148
expect(response.headers.get("content-length")).toBe(TEST_OBJECT_CONTENT.length.toString());
149149
expect(response.headers.has("etag")).toBe(true);
150-
// Default R2 GetObject includes Content-Disposition: attachment; filename="key"
151-
expect(response.headers.get("content-disposition")).toBe(`attachment; filename="${TEST_OBJECT_KEY}"`);
150+
// Default R2 GetObject includes Content-Disposition with sanitized filename and RFC 5987 filename*
151+
expect(response.headers.get("content-disposition")).toBe(`attachment; filename="${TEST_OBJECT_KEY}"; filename*=UTF-8''${encodeURIComponent(TEST_OBJECT_KEY)}`);
152152

153153
const body = await response.text();
154154
expect(body).toBe(TEST_OBJECT_CONTENT);

0 commit comments

Comments
 (0)