Defect #32785
closed
X-Sendfile header field is not set if rack 2.1.0 is installed
Added by Go MAEDA almost 5 years ago.
Updated almost 5 years ago.
Description
$ bin/rails test test/integration/attachments_test.rb
Rack::File is deprecated, please use Rack::Files instead.
Run options: --seed 34165
# Running:
F
Failure:
AttachmentsTest#test_download_should_set_sendfile_header [/private/tmp/redmine-trunk/test/integration/attachments_test.rb:156]:
Expected nil to not be nil.
bin/rails test test/integration/attachments_test.rb:150
Temporary fix for this issue:
diff --git a/Gemfile b/Gemfile
index f5428377d..657545d84 100644
--- a/Gemfile
+++ b/Gemfile
@@ -15,6 +15,9 @@ gem "nokogiri", "~> 1.10.0"
gem "i18n", "~> 1.6.0"
gem "rbpdf", "~> 1.20.0"
+# TODO: Remove the following line when #32785 (AttachmentsTest fails if rack 2.1.0 is installed) is fixed
+gem 'rack', '~> 2.0.8'
+
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :x64_mingw, :mswin]
- Related to Defect #24646: X-Sendfile is missing in response headers added
- Subject changed from AttachmentsTest fails if rack 2.1.0 is installed to X-Sendfile header field is not set if rack 2.1.0 is installed
- Category changed from Gems support to Attachments
- Target version set to 4.0.7
Pavel Rosický wrote:
@GO MAEDA take a look at https://github.com/rack/rack/pull/1463 for the potential fix
Thank you, I have read the page and confirmed that the following patch fixes this issue.
diff --git a/config/application.rb b/config/application.rb
index a06ee4dba..86b695d42 100644
--- a/config/application.rb
+++ b/config/application.rb
@@ -60,7 +60,7 @@ module RedmineApp
config.active_record.sqlite3.represent_boolean_as_integer = true
# Sets the Content-Length header on responses with fixed-length bodies
- config.middleware.insert_after Rack::Sendfile, Rack::ContentLength
+ config.middleware.insert_before Rack::Sendfile, Rack::ContentLength
# Verify validity of user sessions
config.redmine_verify_sessions = true
Setting the target version to 4.0.7.
- Status changed from New to Closed
- Assignee set to Go MAEDA
- Resolution set to Fixed
Also available in: Atom
PDF