Filename of a download-pdf is scambled into 8 characters
Hello to all, I work with Firefox 75.0 (64-bits) and I keep it always updated. My telecomprovider offers me regularly the invoice in pdf-format. When I download it, the filename is changed into 8 characters, not being a sensible or readable name (ie "7fH5Rsd3.pdf"). When I asked the the provider to change this, it was clear it already is. Other customers working with IE or Chrome etc. don't have this problem. It was suggested this could be Firefox itself. The strange thing is this happens only with this provider and apparantly only with me. Everywhere else pdf's or any other file downloads just fine with their respective names. So, what could be the cause? One obscure setting in Firefox? Or should I look elsewhere? BTW: this is happening with all previous versions of Firefox, but I don't know when it started.
All Replies (14)
Hi bankzilla, could you walk me through the downloading steps. For example:
Scenario One
You click a button or link and the file saves automatically to your Downloads folder.
Scenario Two
You click a button or link and Firefox displays a dialog with the option to open the file or save it, and if you choose save, the file saves automatically to your Downloads folder.
Scenario Three
You click a button or link and Firefox displays a dialog with the option to open the file or save it, and if you choose save, Firefox displays a Save As dialog so you can control the folder and file name for the download.
Scenario Four
You click a button or link and Firefox opens the PDF in its familiar built-in PDF Viewer. To download the PDF, you use the download button on the viewer's black toolbar, leading to Scenario Two or Three.
Scenario Five
You click a button or link and Firefox opens the PDF in the site's custom PDF Viewer. To download the PDF, you use whatever link or button the site's viewer provides.
You can try to check this action in the Network Monitor.
- "3-bar" menu button or Tools -> Web Developer
- https://developer.mozilla.org/en-US/Tools/Network_Monitor
Hi there, thanks for answering.
@jscher2000: It's scenario two. In every successive download of the same file, the name is changed in eight different characters.
@cor-el: I started the network monitor and tried different views, but I dont know where to look. Could you enlighten me where to look for?
Lis20 द्वारा
This can happen if the file downloaded to the temp folder and you haven't yet specified the filename (i.e. 'ask me' is selected). Once you have specified a filename then Firefox should rename the file at some point. You may keep the randomized filename if external software keeps a handle/lock on the file.
The network monitor might show in the response headers for this request how the server in sending this file.
It is possible that (anti-virus) security software is causing the problem. Try to disable security software temporarily to see if that makes a difference.
@cor-el: sorry, I don't know where you were talking about, but disabling security didn't enlighten things. But could you tell me why all downloads go well, no matter if a pdf is downloaded with the given filename, or the download is asking me to tell where and with which name the download should be saved? All, except this particular pdf-download? Could you specify the specific sentence or specific words to look for?
I'm sorry to not getting any further response to my questions. I tried several views and researched the network monitor. I can't find anything that could shine a light on this. So far I've excluded (antivirus) security software. Furthermore, as I wrote earlier, this is the only pdf-download that delivers a randomized filename. At the owner of the site's side it's discovered it must be Firefox, because other browsers downloads the same file with the given (normal) name. I tried it myself and yes, it did. So, who can tell me where in Firefox is de name of this pdf randomized at download?
hello lis20
It could be the work of one of your add-ons, or it could be Hardware Acceleration. How to disable Hardware Acceleration {web link}
Type about:addons<enter> in the address bar to open your Add-ons Manager. Hot key; <Control> (Mac=<Command>) <Shift> A)
In the Add-ons Manager, on the left, select Extensions. Disable a few add-ons, then Restart Firefox.
Some added toolbar and anti-virus add-ons are known to cause Firefox issues. Disable All Of them.
If the problem continues, disable some more (restarting FF). Continue until the problem is gone. After, you know what group is causing the issue. Re-enable the last group ONE AT A TIME (restarting FF) until the problem returns.
Once you think you found the problem, disable that and re-enable all the others, then restart again. Let us know who the suspect is, detective.
hope it helps you. thank you
Hello Himanshu prabhakar,
Thanks for your reply. For as far as the Add-ins: I don't use any. Less is better I think. The Hardware Acceleration was on, so I turned it off. After a restart of Firefox I downloaded the pdf-file again, but helas: still an eight-character randomized filename. I'm sorry it didn't work out. But thanks for these suggestions.
It could be the work of one of your add-ons, or it could be Hardware Acceleration. How to disable Hardware Acceleration {web link}
Type about:addons<enter> in the address bar to open your Add-ons Manager. Hot key; <Control> (Mac=<Command>) <Shift> A)
In the Add-ons Manager, on the left, select Extensions. Disable a few add-ons, then Restart Firefox.
Some added toolbar and anti-virus add-ons are known to cause Firefox issues. Disable All Of them.
If the problem continues, disable some more (restarting FF). Continue until the problem is gone. After, you know what group is causing the issue. Re-enable the last group ONE AT A TIME (restarting FF) until the problem returns.
Once you think you found the problem, disable that and re-enable all the others, then restart again. Let us know who the suspect is, detective.
Hi Lis20, this is difficult to investigate without hands on. I think you are seeing the actual file name, which is randomized to limit third party guessing. There are three ways I can think of where Firefox could get the preferred file name:
(1) For a normal link: Using the name of the file from the link -- when you hover over a normal link, the full URL should be shown in the lower left or lower right corner
(2) Preferred name for saving from a link: a website can add an attribute like download="myfilename.pdf" to a link to provide a nicer name -- this isn't visible on hover, but if you right-click the link and choose Inspect Element, you can see whether this attribute is set there
(3) Preferred name for saving from a Content-Disposition header: a website can instruct a browser to show a download dialog instead of opening a file in a tab and include a preferred file name when it returns the PDF:
Content-Disposition: attachment; filename="My Document.pdf"
When there's a space, Firefox needs the quotation marks or the name may be truncated at the first space. But that would make the name My and not a bunch of random characters so there might be some other issue.
It's a little more complicated to see the Content-Disposition header because the Network Monitor tool focuses on what is loading into the same tab. Sometimes I use the Browser Console (Ctrl+Shift+j) for that. Note that on the filter bar along the top of the console, Requests may need to be turned on to see the download request.
Hi there jscher2000. Thanks for answering to my post. It's been a while, but I've been very busy. Helas. In reaction to your suggestions I'll respond to all three:
1) When I hover over the downloadlink of the requested file, the URL shown in the lower left-corner of Firefox shows a path to a htm-file. When I click the link, the file is immediately downloaded with the 8 random characters. There is no question of determining where to put it and how to call it. BTW: that's not what I want: I want the original given name of the file as the issuer had given. I don't want to spend time typing a name.
2) In respect of your second point: this is the code I discovered. As you can see, the desired filename is the invoice date (here: '2020-05-22'):
<span class="invoices-table-row__item invoices-table-row__item--pdf" ng-class="invoice.hasPdf ? 'invoices-table-row__item--pdf' : ''"> ::before <download-invoice-component environment="residential" invoice-data="invoice" invoice-pdf-text="2020-05-22" invoice-nopdf-text=""> <!----> <a href="" ng-if="downloadInvoice.invoiceData.hasPdf" ng-click="downloadInvoice.getInvoicePdf(downloadInvoice.environment)">2020-05-22</a> <!----> <!----> <!----> <!----> </download-invoice-component> </span>
(the first and last row of this html-text is edited as well, but omitted as soon as I upload this message).
3) In respect of your third point: I send hereby a screenshot of the Browser Console. I don't understand any of it, but the first error seems to have something to do with unable to load somthing. The second en third error seems to have something to do with the website-owner not having the right 'reducer'. I don't understand this, but it seems to be odd, for I always work with Firefox and never have had this problem. Also, I cannot believe I'm the only one using Firefox on this site.
So please,again, shine a light on this... Thanks
cor-el द्वारा
Hi Lis20, thank you for taking a closer look. I'm not familiar with these kinds of tags -- "ng-click" is used in the Angular framework, which I don't use -- and seems to be similar to onclick, the attribute to have a script intercept the click. This might not be the final code for the tag considering that the link is empty (href="") but you see a URL when you hover it.
<span class="invoices-table-row__item invoices-table-row__item--pdf" ng-class="invoice.hasPdf ? 'invoices-table-row__item--pdf' : "> <download-invoice-component environment="residential" invoice-data="invoice" invoice-pdf-text="2020-05-22" invoice-nopdf-text=""> <a href="" ng-if="downloadInvoice.invoiceData.hasPdf" ng-click="downloadInvoice.getInvoicePdf(downloadInvoice.environment)">2020-05-22</a> </download-invoice-component> </span>
To bypass the script, you could try right-clicking the link and using Save Link As. Does that allow you to download the file under its real name?
Hi jscher2000. Thanks for answering. No, that's the point: I cannot bypass the script by right-clicking the link. It results in a download of "factuur.htm" which isn't what I need. As I understand your writing, the html-code is invalid? But it only seems to be a problem for someone using Firefox. I don't know who is responsible for this problem: most of the people seem to use other browsers (don't know why...), so the site-owner doesn't want to do anything. Firefox just handles html as it is. So we're puzzling...
In the screenshot I see a Can't use PDF.js error.
What do you see if you click the arrow to expand this message ?
Firefox 78 can use the builtin PDF Viewer in more cases where previous Firefox versions only used this viewer with type="application/pdf".