Signal-Android icon indicating copy to clipboard operation
Signal-Android copied to clipboard

Wrong file suffix on saving videos

Open rmueller83 opened this issue 11 years ago • 34 comments

I just received a video within a group chat in Signal 3.4.0. When I save that video, it is saved to sdcard\Movies\textsecure-2015-11-14-131819.attach

To make it play in other apps I have to open a file manager and rename the video to textsecure-2015-11-14-131819.mp4

I would expect Signal to directly save the file as textsecure-2015-11-14-131819.mp4

rmueller83 avatar Nov 14 '15 12:11 rmueller83

I would expect Signal to directly save the file as textsecure-2015-11-14-131819.mp4

Even better would be "signal-2015-11-14-131819.mp4"... :smile:

RiseT avatar Nov 14 '15 13:11 RiseT

...or the original file name of the senders file ;)

rmueller83 avatar Nov 14 '15 13:11 rmueller83

This happens only when the file does not report a mimetype, so the video file didnt state it was an mp4 thus signal chose the default .attach as the extension.

heyimgay avatar Nov 15 '15 09:11 heyimgay

That's not true:

$ file --mime-type -b textsecure-2015-11-14-131819.attach
video/mp4

rmueller83 avatar Nov 15 '15 09:11 rmueller83

Hey @mcginty i would like to give this a shot ive looked over the code and there is a check to see if the mimetype ==null and then it sets that attachment but that is not where it goes awry. I would love some tips on where to look

heyimgay avatar Nov 15 '15 09:11 heyimgay

@rmueller83 could you upload the video file somewhere? this would make it easier to debug...

agrajaghh avatar Nov 15 '15 17:11 agrajaghh

...or the original file name of the senders file ;)

@rmueller83 Using the sender's original file name could be a privacy issue, though. Same holds true for some embedded Exif metadata like GPS coordinates. Is this stuff stripped off before sending? No idea.

RiseT avatar Nov 16 '15 07:11 RiseT

Sorry, I cannot share the video as it contains personal content. I tried everything to reproduce the problem locally, using the original file + file name and sending it from the emulator to my phone, but without success yet. Btw, the problem is not related to group chats. If I am correct the content type is set by the sender and contained in the message. So I suspect the error is happening on the sender side...

rmueller83 avatar Nov 16 '15 20:11 rmueller83

was it recorded by the sender? If yes, could you maybe ask the sender to record another video and upload it somewhere?

agrajaghh avatar Nov 16 '15 20:11 agrajaghh

The sender just sent me the mp4 sample video (3rd download) from this page: https://support.apple.com/en-us/HT201549 And I also received it with .attach suffix. He is using Signal 3.3.3 on Android 5.0.1, but I could not reproduce this in the emulator using the same versions. :-1:

rmueller83 avatar Nov 16 '15 21:11 rmueller83

I cant reproduce it :smirk:

Maybe its his device? What device is he using?

agrajaghh avatar Nov 16 '15 22:11 agrajaghh

He is using a Moto G 2nd Gen with Android 5.0.2, I have a Moto G 1st Gen with Android 5.1. Perhaps @bartz1 (from #4560) could also try the video and post his specs?

rmueller83 avatar Nov 17 '15 08:11 rmueller83

Regarding the information of the mime type, I think it is important to look at the results from the Android framework. See the referenced issue above.

JavaJens avatar Nov 19 '15 12:11 JavaJens

This is an interesting finding, but it seems that the mentioned method is only called on the receiver side when the attachment is saved. So the saving of a certain mime type would always or never work, which is not the case. I think the misbehavior is due to the value of the contentType argument whose value seems to come from the sender.

rmueller83 avatar Nov 19 '15 13:11 rmueller83

@rmueller83 Yes, this is called on the receiver. But as mentioned there, some manufactures modify this map, so maybe this adds to the difficulty of reproducing: depends on sender/receiver pair.

By skimming the code, it seems that the value of the contentType could possibly come from this mapping as well.

JavaJens avatar Nov 19 '15 14:11 JavaJens

@rmueller83 , any chance you can attach a debugger, set a breakpoint on the following line, and try saving the problem video to see the value of contentType?

SaveAttachmentTask.java, line 124, master HEAD (493bd9b)

    if (extension == null)

unrulygnu avatar Nov 19 '15 15:11 unrulygnu

I just tried this via USB, but Android Studio only shows "No Debuggable Applications". :-(

rmueller83 avatar Nov 19 '15 17:11 rmueller83

Good news: I managed to let him send the sample video to my Signal instance running in the emulator. I cannot see the contentType and extension variables in the variables window (do I need to use a different way of building?) but if I step one line further, the debugger goes into line 125 (extension = "attach";) instead of skipping it. extension

rmueller83 avatar Nov 19 '15 18:11 rmueller83

Ah, you can temporarily add -dontobfuscate to proguard.cfg and rebuild. That will let you inspect local variables. Someone else will probably chime in with a better way, though. :grin:

Thanks for the followup!

unrulygnu avatar Nov 20 '15 01:11 unrulygnu

Thanks, that works. Now I can see that contentType = "video/*" which leads to extension = null. It should be contentType = "video/mp4".

rmueller83 avatar Nov 20 '15 15:11 rmueller83