1
0
mirror of https://github.com/fabianonline/telegram_backup.git synced 2024-11-22 16:56:16 +00:00

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

View File

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