Skip to content

#1 PDF Application on GitHub that lets you edit PDFs on any device anywhere

test(frontend): add URL-encoded filename parsing case (#6436)

Saul Ifshin620f246ca449
diff --git a/frontend/editor/src/core/utils/fileResponseUtils.test.ts b/frontend/editor/src/core/utils/fileResponseUtils.test.ts
index ce2b6cd6d5..5fec0e955f 100644
--- a/frontend/editor/src/core/utils/fileResponseUtils.test.ts
+++ b/frontend/editor/src/core/utils/fileResponseUtils.test.ts
@@ -63,6 +63,14 @@ describe("fileResponseUtils", () => {
expect(filename).toBe("email_content.html");
});
+
+ test("should decode URL-encoded filenames from content-disposition header", () => {
+ const contentDisposition =
+ 'attachment; filename="Quarterly%20Report%20(EN)%20v2.pdf"';
+ const filename = getFilenameFromHeaders(contentDisposition);
+
+ expect(filename).toBe("Quarterly Report (EN) v2.pdf");
+ });
});
describe("createFileFromApiResponse", () => {