Safeguard findUniqueFilename from race conditions

This might partially, but not fully, solve Issue #228 (accidental overwriting).
This commit is contained in:
Yusuke Matsubara 2016-08-15 21:57:13 +09:00
parent 1bdcf3fda0
commit 0714f6ec93

View file

@ -284,7 +284,7 @@ public class UploadService extends HandlerService<Contribution> {
contribution.save();
}
private String findUniqueFilename(String fileName) throws IOException {
synchronized private String findUniqueFilename(String fileName) throws IOException {
return findUniqueFilename(fileName, 1);
}