From ad00695d4ed343d35516faae808e616eb509a63e Mon Sep 17 00:00:00 2001 From: Aldo Mihasi Date: Thu, 8 Dec 2022 13:04:55 +0200 Subject: [PATCH] fix bug allowing invalid characters in pdf name --- .../java/eu/eudat/logic/managers/DataManagementPlanManager.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dmp-backend/web/src/main/java/eu/eudat/logic/managers/DataManagementPlanManager.java b/dmp-backend/web/src/main/java/eu/eudat/logic/managers/DataManagementPlanManager.java index 92bb24daa..59455041d 100644 --- a/dmp-backend/web/src/main/java/eu/eudat/logic/managers/DataManagementPlanManager.java +++ b/dmp-backend/web/src/main/java/eu/eudat/logic/managers/DataManagementPlanManager.java @@ -2142,7 +2142,7 @@ public class DataManagementPlanManager { throw new Exception("DMP already has a DOI");*/ FileEnvelope file = getWordDocument(depositRequest.getDmpId(), principal, configLoader); - String name = file.getFilename().substring(0, file.getFilename().length() - 5).replace(" ", "_").replace(",", "_"); + String name = file.getFilename().substring(0, file.getFilename().length() - 5).replaceAll("[^a-zA-Z0-9_+ ]", "").replace(" ", "_").replace(",", "_"); File pdfFile = PDFUtils.convertToPDF(file, environment); String fileName = name + ".pdf"; ResponseEntity jsonFile;