Added special handling for plain text files without given extension: Will now use .txt instead of .plain.

This commit is contained in:
Fabian Schlenz 2016-09-21 21:07:11 +02:00
parent 42fabf7b1c
commit 45adc77d5e
1 changed files with 7 additions and 1 deletions

View File

@ -68,9 +68,15 @@ public abstract class AbstractMediaFileManager {
public String getTargetPathAndFilename() { return getTargetPath() + getTargetFilename(); }
protected String extensionFromMimetype(String mime) {
switch(mime) {
case "text/plain": return "txt";
}
int i = mime.lastIndexOf('/');
String ext = mime.substring(i+1).toLowerCase();
if (ext=="unknown") ext="dat";
if (ext=="unknown") return "dat";
return ext;
}