Safari appends .html extension to files that are downloaded


I came across a weird issue while downloading files on Safari browser, the files downloaded from one of my server appended had .zip.html to them instead of .zip as expected, though I could remove the extra .html extension and could access the file, that's a bad idea.

This bug was not reported on other browsers like Internet Explorer, Chrome, or Firefox. Thinking about the cause of it, I was able to guess that it was something related to HTTP request/response header issue: MIME or Context-Type

So I used Inspect Element on Safari to check what the Context-Type was set for the response sent to the server. It was wrongly set as ContentType (hyphen missing) causing this problem. The response had two header parameters ContextType: application/xml and Context-Type: text/html

Maybe other browser's were able to resolve this issue thus not causing this issue.

So its the webserver issue. I hope this helps someone who is facing the same problem.

safari header context-type
safari header context-type
Advertisements
Try Out Code2care Dev Tools:

Advertisements



Android Java Linux Microsoft Google Python macOS Notepad++ Microsoft Teams CSS PHP SharePoint Html Linux C Programs Bootstrap jQuery Sublime Android Studio Facebook Eclipse WhatsApp News MySQL Json HowTos JavaScript FTP S3


Advertisements


Code2care is an initiative to publish and share varied knowledge in programming and technical areas gathered during day-to-day learnings and development activities.

Students and Software Developers can leverage this portal to find solutions to their various queries without re-inventing the wheel by referring to our easy to understand posts. Technical posts might include Learnings, Tutorials, Trouble-Shooting steps, Video Tutorials, Code Snippets, How Tos, Blogs, Articles, etc.
🎉 We are celebrating the 10th years of Code2care! Thank you for all your support! We hope we made a difference.
We strong support Gender Equality & Diversity.

We stand in solidarity with Ukraine - Make a donation to UNHCR - https://donate.unhcr.org/in/en-in/ukraine-emergency