Skip to content

Commit

Permalink
Remove IE6-7-8 file download related hack/fix
Browse files Browse the repository at this point in the history
IE 6-7-8 has bug when 'Cache-Control: no-cache' head would break file download.
It's been fixed in IE9 (which is also ancient and barely used version).

Some extra details [here][1] and [here][2].

The way this fix is implemented clashes with what's been done in PR #40324. By
adding ':public' key to cache control header set it wipes default headers.

Since IE 6-7-8 are ancient browsers - let's just get rid of this hack.

[1]: https://stackoverflow.com/q/9766639/843067
[2]: https://stackoverflow.com/q/3415370/843067
  • Loading branch information
tadas-s committed Jun 25, 2021
1 parent 3248812 commit d08035b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 9 deletions.
6 changes: 6 additions & 0 deletions actionpack/CHANGELOG.md
@@ -1,3 +1,9 @@
* Remove IE6-7-8 file download related hack/fix from ActionController::DataStreaming module

Not hugely relevant due to age of those IE versions and it creates somewhat unexpected Cache-Control headers.

*Tadas Sasnauskas*

* Configuration setting to skip logging an uncaught exception backtrace when the exception is
present in `rescued_responses`.

Expand Down
8 changes: 0 additions & 8 deletions actionpack/lib/action_controller/metal/data_streaming.rb
Expand Up @@ -138,14 +138,6 @@ def send_file_headers!(options)
end

headers["Content-Transfer-Encoding"] = "binary"

# Fix a problem with IE 6.0 on opening downloaded files:
# If Cache-Control: no-cache is set (which Rails does by default),
# IE removes the file it just downloaded from its cache immediately
# after it displays the "open/save" dialog, which means that if you
# hit "open" the file isn't there anymore when the application that
# is called for handling the download is run, so let's workaround that
response.cache_control[:public] ||= false
end
end
end
1 change: 0 additions & 1 deletion actionpack/test/controller/send_file_test.rb
Expand Up @@ -146,7 +146,6 @@ def test_send_file_headers_bang
assert_equal "image/png", response.content_type
assert_equal %(disposition; filename="filename"; filename*=UTF-8''filename), response.get_header("Content-Disposition")
assert_equal "binary", response.get_header("Content-Transfer-Encoding")
assert_equal "private", response.get_header("Cache-Control")
end
end

Expand Down

0 comments on commit d08035b

Please sign in to comment.