From 620f246ca4491518ca3320abe981c3292cc0dd91 Mon Sep 17 00:00:00 2001 From: Saul Ifshin <97627272+saul1310@users.noreply.github.com> Date: Tue, 26 May 2026 15:29:32 -0700 Subject: [PATCH] test(frontend): add URL-encoded filename parsing case (#6436) # Description of Changes --- ## Checklist ### General - [x] I have read the [Contribution Guidelines](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/CONTRIBUTING.md) - [x] I have read the [Stirling-PDF Developer Guide](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/DeveloperGuide.md) (if applicable) - [x] I have read the [How to add new languages to Stirling-PDF](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/devGuide/HowToAddNewLanguage.md) (if applicable) - [x] I have performed a self-review of my own code - [x] My changes generate no new warnings ### Documentation - [x] I have updated relevant docs on [Stirling-PDF's doc repo](https://github.com/Stirling-Tools/Stirling-Tools.github.io/blob/main/docs/) (if functionality has heavily changed) - [x] I have read the section [Add New Translation Tags](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/devGuide/HowToAddNewLanguage.md#add-new-translation-tags) (for new translation tags only) ### Translations (if applicable) - [x] I ran [`scripts/counter_translation.py`](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/docs/counter_translation.md) ### UI Changes (if applicable) - [x] Screenshots or videos demonstrating the UI changes are attached (e.g., as comments or direct attachments in the PR) ### Testing (if applicable) - [x] I have run `task check` to verify linters, typechecks, and tests pass - [x] I have tested my changes locally. Refer to the [Testing Guide](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/DeveloperGuide.md#7-testing) for more details. --- frontend/editor/src/core/utils/fileResponseUtils.test.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/frontend/editor/src/core/utils/fileResponseUtils.test.ts b/frontend/editor/src/core/utils/fileResponseUtils.test.ts index ce2b6cd6d..5fec0e955 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", () => {