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

Recent Posts:

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, Video Tutorials, Code Snippets, How Tos, Blogs, Articles, etc.