mirror of
https://github.com/oven-sh/bun
synced 2026-02-16 22:01:47 +00:00
test: rename to issue number and improve filename regex
- Rename test file to 26959.test.ts per regression test convention - Fix Content-Disposition regex to match filename parameter anywhere in the header value, not just as the entire value - Assert the regex match is found before checking captured group Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -47,11 +47,10 @@ test("Content-Disposition header injection via quotes in File name", async () =>
|
||||
if (contentDisposition) {
|
||||
expect(contentDisposition).not.toContain("\r");
|
||||
expect(contentDisposition).not.toContain("\n");
|
||||
// The inner filename value should not contain unescaped double quotes
|
||||
const match = contentDisposition.match(/^filename="(.*)"$/);
|
||||
if (match) {
|
||||
expect(match[1]).not.toContain('"');
|
||||
}
|
||||
// The filename parameter value should not contain unescaped double quotes
|
||||
const match = contentDisposition.match(/filename="([^"]*)"/);
|
||||
expect(match).not.toBeNull();
|
||||
expect(match![1]).not.toContain('"');
|
||||
}
|
||||
|
||||
expect(body).toBe("hello");
|
||||
Reference in New Issue
Block a user