downthemall / downthemall

The DownThemAll! WebExtension
https://downthemall.org/
Other
932 stars 104 forks source link

Extensions of files change once the download begins #217

Open mjolnir870 opened 4 years ago

mjolnir870 commented 4 years ago

Desktop (please complete the following information):

Describe the bug When a queued .wmv file begins downloading, the extension changes to .asx.

To Reproduce Steps to reproduce the behavior:

  1. Queue a .wmv download.
  2. When download starts, the extension changes to .asx.

Expected behavior The .asx file extension is incorrect. I don't want the extension to change from what I already queued.

Additional context This also happens with .m4v files, which are renamed to .mp4.

LachlanAndrew commented 4 years ago

I'm not a developer, but my guess is that the new extension is for the actual type of the file, as reported by the web protocol, HTTP. Neither the extension nor the type reported by HTTP tells you what type of data is really in the file itself; you just have to trust that someone named it correctly. If there is a mismatch between the two, it is the fault of the web site not the dTa.

Does it happen with .wmv files from all sites? Can you please list a few different sites that show the problem?

(Devs: If my guess is correct, a workaround may be possible, by renaming the file back to having the original extension once the browser has downloaded the file, if there is a hook called on completion.)

mjolnir870 commented 4 years ago

Neither the extension nor the type reported by HTTP tells you what type of data is really in the file itself; you just have to trust that someone named it correctly. If there is a mismatch between the two, it is the fault of the web site not the dTa.

Does it happen with .wmv files from all sites? Can you please list a few different sites that show the problem?

(Devs: If my guess is correct, a workaround may be possible, by renaming the file back to having the original extension once the browser has downloaded the file, if there is a hook called on completion.)

It happens on all wmv files, because the mime type is being served as video/x-ms-asf. Regardless, I don't think it's accurate for the extension to rename files unless I tell it to. This is also not how it behaved in DTA 3.x - ext would use the file's extension, not something derived from mime type.

nmaier commented 4 years ago

I'd need more information to diagnose this.

projekter commented 4 years ago

I have the same issue with text files that have a different extension. For example, if I try to download this file, the proper filename is test1.qasm, but the Save File dialog opens with filename test1.txt prefilled.

I am using Opera with DTA 4.2.3.

scrobbleme commented 3 years ago

DTA 4.2.6 in latest Chrome 87.0.4280.88

Here is a file (it's in the ZIP): SiteInformation.zip