File tree Expand file tree Collapse file tree
exist-core/src/main/java/org/exist/http/servlets Expand file tree Collapse file tree Original file line number Diff line number Diff line change 6161public class HttpRequestWrapper implements RequestWrapper {
6262
6363 private static final Logger LOG = LogManager .getLogger (HttpRequestWrapper .class );
64-
64+
65+ private static final Path TMP_DIR ;
66+ static {
67+ try {
68+ TMP_DIR = Files .createTempDirectory ("" );
69+ } catch (final IOException e ) {
70+ throw new RuntimeException ("Unable to create temporary directory for HttpRequestWrapper" , e );
71+ }
72+ }
73+
6574 private final HttpServletRequest servletRequest ;
6675 @ Nullable private final String formEncoding ;
6776 @ Nullable private String containerEncoding ;
@@ -545,13 +554,19 @@ public List<Path> getFileUploadParam(final String name) {
545554
546555 if (temporaryUploadedFilePath == null ) {
547556 try {
548- temporaryUploadedFilePath = Files .createTempFile (null , null );
557+ final String tmpFilename = UUID .randomUUID ().toString () + ".tmp" ;
558+
559+ temporaryUploadedFilePath = TMP_DIR .resolve (tmpFilename );
549560 part .write (temporaryUploadedFilePath .toAbsolutePath ().toString ());
550561 } catch (final IOException e ) {
551562 LOG .warn (e );
552563 continue ;
553564 }
554565
566+ if (temporaryUploadedFilesPathCache == null ) {
567+ temporaryUploadedFilesPathCache = new HashMap <>();
568+ }
569+
555570 temporaryUploadedFilesPathCache .put (part , temporaryUploadedFilePath );
556571 }
557572
You can’t perform that action at this time.
0 commit comments