From ee2de5d929757875a16193d32bcb570ee5c6aefa Mon Sep 17 00:00:00 2001 From: Zheng Feng Date: Wed, 18 Dec 2024 14:59:58 +0800 Subject: [PATCH] CAMEL-21557: camel-platform-http-starter - improve to use a unique filename for the uploadedTmpFile (#1308) (cherry picked from commit 7f9f4f430ea8c9d1deed9710fe0d08b6f14e84a3) --- .../http/springboot/SpringBootPlatformHttpBinding.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/components-starter/camel-platform-http-starter/src/main/java/org/apache/camel/component/platform/http/springboot/SpringBootPlatformHttpBinding.java b/components-starter/camel-platform-http-starter/src/main/java/org/apache/camel/component/platform/http/springboot/SpringBootPlatformHttpBinding.java index 1aa304669af..34ed383143e 100644 --- a/components-starter/camel-platform-http-starter/src/main/java/org/apache/camel/component/platform/http/springboot/SpringBootPlatformHttpBinding.java +++ b/components-starter/camel-platform-http-starter/src/main/java/org/apache/camel/component/platform/http/springboot/SpringBootPlatformHttpBinding.java @@ -52,6 +52,7 @@ import java.nio.file.Path; import java.nio.file.Paths; import java.util.Locale; +import java.util.UUID; public class SpringBootPlatformHttpBinding extends DefaultHttpBinding { private static final Logger LOG = LoggerFactory.getLogger(SpringBootPlatformHttpBinding.class); @@ -86,7 +87,7 @@ protected void populateAttachments(HttpServletRequest request, Message message) File tmpFolder = (File) request.getServletContext().getAttribute(ServletContext.TEMPDIR); multipartHttpServletRequest.getFileMap().forEach((name, multipartFile) -> { try { - Path uploadedTmpFile = Paths.get(tmpFolder.getPath(), name); + Path uploadedTmpFile = Paths.get(tmpFolder.getPath(), UUID.randomUUID().toString()); multipartFile.transferTo(uploadedTmpFile); if (name != null) {