Saved attachments with contentType "image/jpg" named with ".attach" extension
In SaveAttachmentTask.java, the call to mimeTypeMap.getExtensionFromMimeType(contentType) with the type image/jpg returns null on devices with the AOSP version of MimeUtils.java. This is because the Android platform doesn't recognize image/jpg as a valid MIME type.
With the image/jpeg type, however, an extension is returned as expected.
MimeUtils.java (AOSP)
add("image/ief", "ief");
// add ".jpg" first so it will be the default for guessExtensionFromMimeType
add("image/jpeg", "jpg");
add("image/jpeg", "jpeg");
add("image/jpeg", "jpe");
add("image/pcx", "pcx");
I've dealt with issues in the past where device manufacturers have edited this map (love you, Samsung ㅗ*.*ㅗ), which may result in sending devices using content types which receiving devices cannot look up via getExtensionFromMimeType. Where to put a sanitizer might be a bit tricky. I'll dig deeper tomorrow.
I think this is related to #4536 but this has some evidence to the reasons.
A friend of mine still has this problem with 3.7.1. Can someone confirm? Or are old attachments not fixed by this commit?
@mawed: I tested this on message attachments received both before and after the patch. A few questions:
- What was the file extension of the attached file on the sender's device?
- Was the file sent via Signal or MMS? If Signal, what version?
- What devices and OS versions do the sender and receiver have?
As a test he sent me a mp4 today. Saving it, I got an .attach file. I use Android signal 3.7.2. He uses also Android signal.
The video was sent using signal message.
He also stated, the problem was gone some versions ago. Am 11. Dezember 2015 05:16:51 MEZ, schrieb Geonu Kang [email protected]:
@mawed: I tested this on message attachments received both before and after the patch. A few questions:
- What was the file extension of the attached file on the sender's device?
- Was the file sent via Signal or MMS? If Signal, what version?
- What devices and OS versions do the sender and receiver have?
Reply to this email directly or view it on GitHub: https://github.com/WhisperSystems/Signal-Android/issues/4602#issuecomment-163835166
@mawed: This issue and related PR addressed only issues caused by MIME type image/jpg.
See Issue #4536 and PR #4689 regarding videos. I have to update the PR, should be fixed soon.