Limit file name length

This commit is contained in:
M66B 2019-07-30 09:03:54 +02:00
parent 954c8db225
commit 2c4c91f7cf
1 changed files with 8 additions and 1 deletions

View File

@ -528,7 +528,14 @@ public class Helper {
static String sanitizeFilename(String name) {
if (name == null)
return null;
return name.replaceAll("[?:\"*|/\\\\<>]", "_");
name = name.replaceAll("[?:\"*|/\\\\<>]", "_");
// Both the name and extension can be long
if (name.length() > 255)
name = name.substring(0, 255);
return name;
}
static String getExtension(String filename) {