Incorrect file format
It has been observed that when a user uses the Firefox browser and tries to download a DDD file, the file format is .pdf instead of .ddd. In the devtools, it was observed that the content-type is text/plain in the response to the request. I changed the content-type to application/octet-stream, but the error still persists
Выбранное решение
There is a preference that could be related to this problem, but a user workaround obviously is not the best solution. Still, it is worth a test to see whether file extension sanitization is the culprit:
(1) In a new tab, type or paste about:config in the address bar and press Enter/Return. Click the button accepting the risk.
More info on about:config: Configuration Editor for Firefox. The moderators would like us to remind you that changes made through this back door aren't fully supported and aren't guaranteed to continue working in the future.
(2) In the search box in the page, type or paste browser.download.sanitize_non_media_extensions and pause while the list is filtered
(3) Double-click the preference (or click the toggle button) to switch the value from true to false
I think that could take effect immediately on the next download, but if the value was cached for the whole session, it would take effect after a regular Firefox shutdown/restart.
Прочитайте этот ответ в контексте 👍 1Все ответы (18)
Does the file work properly if you change the file extension to .ddd ?
Firefox might be sniffing the file header to determine whether it should be opened in the PDF Viewer. Does the file start with a classic PDF header, for example, %PDF-1.5 ?
jscher2000 - Support Volunteer said
Firefox might be sniffing the file header to determine whether it should be opened in the PDF Viewer. Does the file start with a classic PDF header, for example, %PDF-1.5 ?
File starts with: 'dgGX+g60m5XF+4SBJNkmPC...
Изменено
cor-el said
Does the file work properly if you change the file extension to .ddd ?
Files are being downloaded and opened as *.pdf, even though the code specifies that it should be *.ddd. The issue occurs only in Firefox. In other browsers, the file loads as .ddd.
Hmm, strange. When you say it is opening as a PDF, does the PDF viewer understand the file as a PDF or object to the file as being in an unrecognizable format or corrupt?
On any given installation, Firefox might have saved an association of a particular file extension and a particular content type. For example, a site might identify a .pdf file as an application/download type, which could interfere with the normal identification as application/pdf. But it's strange that multiple users would be afflicted at the same time.
To check for such an association, could you open the handlers.json file in a tab in Firefox? This would be in the currently active profile folder. You can use a button on the Troubleshooting Information page to launch Finder in that folder, then drag and drop handlers.json back onto the Troubleshooting Information page to open it. After a few moments, Firefox should display a structured view.
Then use Find in page (Command+F) to see whether "ddd" appears as an extension for application/pdf or any unexpected content types?
What I meant is that you download and save the file and if it has a .pdf file extension then change the filename to .ddd.
cor-el said
What I meant is that you download and save the file and if it has a .pdf file extension then change the filename to .ddd.
As a programmer, unfortunately, I cannot suggest a solution where our client would have to change the file extension every time.
This was just to confirm that this is only a problem with the file extension and that the file is still correct. Do all others also get the same wrong .pdf file extension as it is possible that this only happens on your computer?
cor-el said
This was just to confirm that this is only a problem with the file extension and that the file is still correct. Do all others also get the same wrong .pdf file extension as it is possible that this only happens on your computer?
Others also get the same wrong *.pdf file extension
Hi Borys, do you have an application installed on your Mac that opens .ddd files? It may have registered a MIME type for them. I don't know whether you can find that in a Get Info dialog or through some other means -- on Windows, I would check the Registry. If there is a standard for that, you could try using that as your Content-Type on the website instead of using a generic indicator and see whether it works around the problem.
jscher2000 - Support Volunteer said
Hi Borys, do you have an application installed on your Mac that opens .ddd files? It may have registered a MIME type for them. I don't know whether you can find that in a Get Info dialog or through some other means -- on Windows, I would check the Registry. If there is a standard for that, you could try using that as your Content-Type on the website instead of using a generic indicator and see whether it works around the problem.
Hi! In our web application, we've implemented the feature allowing clients to download files with the .ddd extension. However, some Firefox users have reported to our support team that these files are downloading as .pdf. Although I don't use Firefox myself, I installed it to verify this issue, testing it after a clean installation without any user-specific settings. I don't have any applications to open .ddd files, and other programmers have encountered the same issue in Firefox, so it's not just a problem on my MacBook. In other browsers like Chrome and Safari, this issue doesn't occur, and files download with the correct .ddd extension
Does the downloaded file size and checksum match the one on the server?
Does it still happen with the ESR version (115)?
zeroknight powiedział
Does the downloaded file size and checksum match the one on the server? Does it still happen with the ESR version (115)?
The file size and checksum are the same. The error still happen with ESR (version 115).
Выбранное решение
There is a preference that could be related to this problem, but a user workaround obviously is not the best solution. Still, it is worth a test to see whether file extension sanitization is the culprit:
(1) In a new tab, type or paste about:config in the address bar and press Enter/Return. Click the button accepting the risk.
More info on about:config: Configuration Editor for Firefox. The moderators would like us to remind you that changes made through this back door aren't fully supported and aren't guaranteed to continue working in the future.
(2) In the search box in the page, type or paste browser.download.sanitize_non_media_extensions and pause while the list is filtered
(3) Double-click the preference (or click the toggle button) to switch the value from true to false
I think that could take effect immediately on the next download, but if the value was cached for the whole session, it would take effect after a regular Firefox shutdown/restart.
jscher2000 - Support Volunteer powiedział
There is a preference that could be related to this problem, but a user workaround obviously is not the best solution. Still, it is worth a test to see whether file extension sanitization is the culprit: (1) In a new tab, type or paste about:config in the address bar and press Enter/Return. Click the button accepting the risk. More info on about:config: Configuration Editor for Firefox. The moderators would like us to remind you that changes made through this back door aren't fully supported and aren't guaranteed to continue working in the future. (2) In the search box in the page, type or paste browser.download.sanitize_non_media_extensions and pause while the list is filtered (3) Double-click the preference (or click the toggle button) to switch the value from true to false I think that could take effect immediately on the next download, but if the value was cached for the whole session, it would take effect after a regular Firefox shutdown/restart.
Yes, it worked!
Thank you for testing that.
Does the dialog in your second screenshot open automatically? I don't know why Firefox would be trying to auto-open an application/octet-stream file rather than auto-saving it. You could trying changing the content-type to something made up like
application/x-dddfile
which Firefox has no reason to try to open.
More generally, if something in the extension sanitizing routine associates the files (the content type or the .ddd extension?) with .pdf, I don't know what it is. It's difficult to imagine that this is caused by a built-in setting for ddd, but it's also difficult to imagine that the systems of affected users associate application/octet-stream with PDFs. I'm puzzled.
jscher2000 - Support Volunteer powiedział
Thank you for testing that. Does the dialog in your second screenshot open automatically? I don't know why Firefox would be trying to auto-open an application/octet-stream file rather than auto-saving it. You could trying changing the content-type to something made up like application/x-dddfile which Firefox has no reason to try to open. More generally, if something in the extension sanitizing routine associates the files (the content type or the .ddd extension?) with .pdf, I don't know what it is. It's difficult to imagine that this is caused by a built-in setting for ddd, but it's also difficult to imagine that the systems of affected users associate application/octet-stream with PDFs. I'm puzzled.
Thank you so much for your help!