Escape special chars in filename which includes user input

This commit is contained in:
Tim Donohue
2020-07-27 15:08:05 -05:00
parent c323b989d2
commit 79e4e3b497

View File

@@ -245,6 +245,8 @@ public class DepositManager {
String filenameBase =
"sword-" + deposit.getUsername() + "-" + (new Date()).getTime();
// No dots or slashes allowed in filename
filenameBase = filenameBase.replaceAll("\\.", "").replaceAll("/", ""). replaceAll("\\\\", "");
File packageFile = new File(path, filenameBase);
File headersFile = new File(path, filenameBase + "-headers");