Skip to content

Commit

Permalink
Fixed file upload tmp directory creation when root directory is not w…
Browse files Browse the repository at this point in the history
…rittable by application #449.
  • Loading branch information
tkomlodi committed Nov 14, 2023
1 parent 98cecd1 commit 6ce0de9
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,10 @@ public UnrestrictedFileUpload() throws IOException, URISyntaxException {
"If you are running vulnerableApp as a Jar then UnrestrictedFileUpload will not work. "
+ "For more information: https://github.com/SasanLabs/VulnerableApp/issues/255",
e);
if (root != null) {
if (root == null || !root.toFile().exists()) {

This comment has been minimized.

Copy link
@tkomlodi

tkomlodi Nov 14, 2023

Author Contributor

Updated code will set root and contentDispositionRoot below to a temporary folder if they weren't created for any reason. If they were created successfully, they won't be changed.

root = Files.createTempDirectory(null);
}
if (contentDispositionRoot != null) {
if (contentDispositionRoot == null || !contentDispositionRoot.toFile().exists()) {
contentDispositionRoot = Files.createTempDirectory(null);
}
}
Expand Down

0 comments on commit 6ce0de9

Please sign in to comment.