Skip to content
Snippets Groups Projects
Commit 6ee8e656 authored by Sonia Zorba's avatar Sonia Zorba
Browse files

Fixed concurrency issue on multiple files upload

parent 99dd1b35
No related branches found
No related tags found
No related merge requests found
Pipeline #896 passed
......@@ -83,11 +83,17 @@ public class PutFileController {
File file = path.toFile();
/**
* This block must be synchronized, to avoid concurrency issues when
* multiple files are uploaded to a new folder in parallel.
*/
synchronized (this) {
if (!file.getParentFile().exists()) {
if (!file.getParentFile().mkdirs()) {
throw new IllegalStateException("Unable to create parent folder: " + file.getParentFile().getAbsolutePath());
}
}
}
Files.copy(is, file.toPath());
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment