mirror of
https://github.com/PhotonVision/photonvision
synced 2026-06-19 00:41:41 +00:00
More carefully check file creation status (#958)
This commit is contained in:
@@ -537,9 +537,12 @@ public class RequestHandler {
|
||||
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();
|
||||
}
|
||||
|
||||
@@ -547,7 +550,10 @@ public class RequestHandler {
|
||||
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();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user