diff --git a/photon-server/src/main/java/org/photonvision/server/RequestHandler.java b/photon-server/src/main/java/org/photonvision/server/RequestHandler.java index c255748195..42b8e0a173 100644 --- a/photon-server/src/main/java/org/photonvision/server/RequestHandler.java +++ b/photon-server/src/main/java/org/photonvision/server/RequestHandler.java @@ -495,9 +495,9 @@ private static Optional handleTempFileCreation(UploadedFile file) { new File(Path.of(System.getProperty("java.io.tmpdir"), file.filename()).toString()); boolean makeDirsRes = tempFilePath.getParentFile().mkdirs(); - if (!makeDirsRes) { + if (!makeDirsRes && !(tempFilePath.getParentFile().exists())) { logger.error( - "There was an error while uploading " + file.filename() + " to the temp folder!"); + "There was an error while creating " + tempFilePath.getAbsolutePath() + "! Exists: " + tempFilePath.getParentFile().exists()); return Optional.empty(); } @@ -505,7 +505,7 @@ private static Optional handleTempFileCreation(UploadedFile file) { FileUtils.copyInputStreamToFile(file.content(), tempFilePath); } catch (IOException e) { logger.error( - "There was an error while uploading " + file.filename() + " to the temp folder!"); + "There was an error while copying " + file.filename() + " to the temp file " + tempFilePath.getAbsolutePath()); return Optional.empty(); }