diff options
author | Daniel Gultsch <inputmice@siacs.eu> | 2015-01-11 15:19:36 +0100 |
---|---|---|
committer | Daniel Gultsch <inputmice@siacs.eu> | 2015-01-11 15:19:36 +0100 |
commit | b07b7519a6bf382be809b8d33b801080a1616c8f (patch) | |
tree | 98a14abedbb965f7b06f56c9f54705f032183d24 /src/main/java/eu/siacs/conversations/xmpp/jingle/JingleConnection.java | |
parent | 12d63f2612377fbbb01e885145e2366bf0835f47 (diff) |
keep proper image file extension
Diffstat (limited to 'src/main/java/eu/siacs/conversations/xmpp/jingle/JingleConnection.java')
-rw-r--r-- | src/main/java/eu/siacs/conversations/xmpp/jingle/JingleConnection.java | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/main/java/eu/siacs/conversations/xmpp/jingle/JingleConnection.java b/src/main/java/eu/siacs/conversations/xmpp/jingle/JingleConnection.java index cea4346c4..843cf1e63 100644 --- a/src/main/java/eu/siacs/conversations/xmpp/jingle/JingleConnection.java +++ b/src/main/java/eu/siacs/conversations/xmpp/jingle/JingleConnection.java @@ -101,11 +101,9 @@ public class JingleConnection implements Downloadable { file.delete(); } } - Log.d(Config.LOGTAG, - "sucessfully transmitted file:" + file.getAbsolutePath()); + Log.d(Config.LOGTAG,"sucessfully transmitted file:" + file.getAbsolutePath()); if (message.getEncryption() != Message.ENCRYPTION_PGP) { - Intent intent = new Intent( - Intent.ACTION_MEDIA_SCANNER_SCAN_FILE); + Intent intent = new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE); intent.setData(Uri.fromFile(file)); mXmppConnectionService.sendBroadcast(intent); } @@ -281,15 +279,17 @@ public class JingleConnection implements Downloadable { if (fileNameElement != null) { String[] filename = fileNameElement.getContent() .toLowerCase(Locale.US).toLowerCase().split("\\."); - if (Arrays.asList(VALID_IMAGE_EXTENSIONS).contains( - filename[filename.length - 1])) { + String extension = filename[filename.length - 1]; + if (Arrays.asList(VALID_IMAGE_EXTENSIONS).contains(extension)) { message.setType(Message.TYPE_IMAGE); + message.setRelativeFilePath(message.getUuid()+"."+extension); } else if (Arrays.asList(VALID_CRYPTO_EXTENSIONS).contains( filename[filename.length - 1])) { if (filename.length == 3) { - if (Arrays.asList(VALID_IMAGE_EXTENSIONS).contains( - filename[filename.length - 2])) { + extension = filename[filename.length - 2]; + if (Arrays.asList(VALID_IMAGE_EXTENSIONS).contains(extension)) { message.setType(Message.TYPE_IMAGE); + message.setRelativeFilePath(message.getUuid()+"."+extension); } else { message.setType(Message.TYPE_FILE); } |