From 4670c698eeb4aad5d95e8567a8758d431359155a Mon Sep 17 00:00:00 2001 From: Alf Eaton Date: Wed, 17 May 2023 13:53:15 +0100 Subject: [PATCH] Allow digits in PDF filenames (#13122) GitOrigin-RevId: 58c93d299c3bfe79dd4c223b8b060411bad078c7 --- services/web/app/src/Features/Compile/CompileController.js | 2 +- services/web/test/unit/src/Compile/CompileControllerTests.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/services/web/app/src/Features/Compile/CompileController.js b/services/web/app/src/Features/Compile/CompileController.js index 1b8bc1aeb0..897ca5c14f 100644 --- a/services/web/app/src/Features/Compile/CompileController.js +++ b/services/web/app/src/Features/Compile/CompileController.js @@ -371,7 +371,7 @@ module.exports = CompileController = { }, _getSafeProjectName(project) { - return project.name.replace(/\P{L}/gu, '_') + return project.name.replace(/[^\p{L}\p{Nd}]/gu, '_') }, deleteAuxFiles(req, res, next) { diff --git a/services/web/test/unit/src/Compile/CompileControllerTests.js b/services/web/test/unit/src/Compile/CompileControllerTests.js index f21e7d9520..1b1889ff82 100644 --- a/services/web/test/unit/src/Compile/CompileControllerTests.js +++ b/services/web/test/unit/src/Compile/CompileControllerTests.js @@ -356,7 +356,7 @@ describe('CompileController', function () { this.req.params = { Project_id: this.projectId } this.req.query = { pdfng: true } - this.project = { name: 'test namè;' } + this.project = { name: 'test namè; 1' } this.ProjectGetter.getProject = sinon .stub() .callsArgWith(2, null, this.project) @@ -380,7 +380,7 @@ describe('CompileController', function () { it('should set the content-disposition header with a safe version of the project name', function () { this.res.setContentDisposition.should.be.calledWith('inline', { - filename: 'test_namè_.pdf', + filename: 'test_namè__1.pdf', }) })