mirror of https://github.com/M66B/FairEmail.git
Fixed long attachment names
This commit is contained in:
parent
d9dd78e3a7
commit
0affd9e1f3
|
@ -114,6 +114,8 @@ public class EntityAttachment {
|
||||||
String filename = Long.toString(id);
|
String filename = Long.toString(id);
|
||||||
if (!TextUtils.isEmpty(name))
|
if (!TextUtils.isEmpty(name))
|
||||||
filename += "." + Helper.sanitizeFilename(name);
|
filename += "." + Helper.sanitizeFilename(name);
|
||||||
|
if (filename.length() > 255)
|
||||||
|
filename = filename.substring(0, 255);
|
||||||
return new File(dir, filename);
|
return new File(dir, filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -529,13 +529,7 @@ public class Helper {
|
||||||
if (name == null)
|
if (name == null)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
name = name.replaceAll("[?:\"*|/\\\\<>]", "_");
|
return 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) {
|
static String getExtension(String filename) {
|
||||||
|
|
Loading…
Reference in New Issue