Tartışmalar » Oluşturma İstekleri

request firefox download filename bug fix

§
Gönderildi: 20.02.2017

request firefox download filename bug fix

some site download filename is broken.

maybe filename include space

ex) test sample.rar

firefox only get 'test' filename.

https://www.codeproject.com/Tips/745949/Download-File-Firefox-Issue

how to fix?

woxxomMod
§
Gönderildi: 20.02.2017
§
Gönderildi: 21.02.2017
Düzenlendi: 21.02.2017

If the filename is passed from the server in the manner described on the CodeProject article, I don't think there is a way to recover the missing part of the file name.

In theory, an XMLHttpRequest HEAD request could provide access to the response headers, and that might allow reconstructing the file name. (I didn't try it.)

And then with that information you could set the download attribute on the link to supply the desired file name.

Unfortunately, Firefox gives the filename from the HTTP header precedence over the download attribute, so this method most likely would not work.

* http://dev.jeffersonscher.com/space/
* https://developer.mozilla.org/docs/Web/HTML/Element/a#Attributes

Instead of modifying the download link, using the method of downloading the file as a blob of binary data -- mentioned on StackOverflow -- might work, but I didn't look into it.

§
Gönderildi: 21.02.2017
Düzenlendi: 21.02.2017

http://www.polarcloud.com/truncfix

truncfix is space filename fix add-on

but truncfix apply all site..

i want to white site only work..

userscript is impossable?

§
Gönderildi: 21.02.2017
truncfix is space filename fix add-on

I don't think the method used by that extension can work in a userscript -- it modifies the HTTP header by adding the missing quotation marks:

hc.setResponseHeader("content-disposition", hc.getResponseHeader("content-disposition").replace(/(;\s*filename\s*=\s*)([^\";]+)/, "$1\"$2\"")

That requires an early intervention, before the page starts loading, so I suspect by the time Greasemonkey runs, it's too late. Not to mention that it uses privileged methods that scripts do not have access to...

So some other approach would be needed.

woxxomMod
§
Gönderildi: 21.02.2017

Someone familiar with Firefox addon development can modify it to run only on the required site.

§
Gönderildi: 22.02.2017

thanks! everybody

i understand

Cevap paylaş

Yanıt göndermek için oturum açın.