File tree Expand file tree Collapse file tree 1 file changed +17
-2
lines changed
exist-core/src/main/java/org/exist/http/servlets Expand file tree Collapse file tree 1 file changed +17
-2
lines changed Original file line number Diff line number Diff line change 61
61
public class HttpRequestWrapper implements RequestWrapper {
62
62
63
63
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
+
65
74
private final HttpServletRequest servletRequest ;
66
75
@ Nullable private final String formEncoding ;
67
76
@ Nullable private String containerEncoding ;
@@ -545,13 +554,19 @@ public List<Path> getFileUploadParam(final String name) {
545
554
546
555
if (temporaryUploadedFilePath == null ) {
547
556
try {
548
- temporaryUploadedFilePath = Files .createTempFile (null , null );
557
+ final String tmpFilename = UUID .randomUUID ().toString () + ".tmp" ;
558
+
559
+ temporaryUploadedFilePath = TMP_DIR .resolve (tmpFilename );
549
560
part .write (temporaryUploadedFilePath .toAbsolutePath ().toString ());
550
561
} catch (final IOException e ) {
551
562
LOG .warn (e );
552
563
continue ;
553
564
}
554
565
566
+ if (temporaryUploadedFilesPathCache == null ) {
567
+ temporaryUploadedFilesPathCache = new HashMap <>();
568
+ }
569
+
555
570
temporaryUploadedFilesPathCache .put (part , temporaryUploadedFilePath );
556
571
}
557
572
You can’t perform that action at this time.
0 commit comments