From d3b289a5a7b4bdd433646c739254006bfbb35e3c Mon Sep 17 00:00:00 2001 From: Mobb autofixer Date: Mon, 25 Nov 2024 18:12:18 +0000 Subject: [PATCH] mobb fix commit: fc3ffdef-5bd2-4386-a78e-771cffeb8e21 --- .../microfocus/example/service/FileSystemStorageService.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/microfocus/example/service/FileSystemStorageService.java b/src/main/java/com/microfocus/example/service/FileSystemStorageService.java index a5a6197b..45cb178b 100644 --- a/src/main/java/com/microfocus/example/service/FileSystemStorageService.java +++ b/src/main/java/com/microfocus/example/service/FileSystemStorageService.java @@ -51,7 +51,7 @@ public void store(MultipartFile file) { throw new StorageException("Failed to store empty file."); } Path destinationFile = this.rootLocation.resolve( - Paths.get(file.getOriginalFilename())) + Paths.get(String.valueOf(file.getOriginalFilename()).replaceAll("([/\\\\:*?\"<>|])|(^\\s)|([.\\s]$)", "_").replaceAll("\0", ""))) .normalize().toAbsolutePath(); if (!destinationFile.getParent().equals(this.rootLocation.toAbsolutePath())) { // This is a security check