From 45adc77d5e502fca4057126b7c655cf94137f08f Mon Sep 17 00:00:00 2001 From: Fabian Schlenz Date: Wed, 21 Sep 2016 21:07:11 +0200 Subject: [PATCH] Added special handling for plain text files without given extension: Will now use .txt instead of .plain. --- .../mediafilemanager/AbstractMediaFileManager.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main/java/de/fabianonline/telegram_backup/mediafilemanager/AbstractMediaFileManager.java b/src/main/java/de/fabianonline/telegram_backup/mediafilemanager/AbstractMediaFileManager.java index c9877c5..7e1f68f 100644 --- a/src/main/java/de/fabianonline/telegram_backup/mediafilemanager/AbstractMediaFileManager.java +++ b/src/main/java/de/fabianonline/telegram_backup/mediafilemanager/AbstractMediaFileManager.java @@ -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; }