Project

General

Profile

Actions

Defect #32785

closed

X-Sendfile header field is not set if rack 2.1.0 is installed

Added by Go MAEDA about 4 years ago. Updated about 4 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Attachments
Target version:
Start date:
Due date:
% Done:

0%

Estimated time:
Resolution:
Fixed
Affected version:

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

Related issues

Related to Redmine - Defect #24646: X-Sendfile is missing in response headersClosedJean-Philippe Lang

Actions
Actions #1

Updated by Go MAEDA about 4 years ago

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]

Actions #2

Updated by Pavel Rosický about 4 years ago

this is related to https://www.redmine.org/issues/24646

@GO MAEDA take a look at https://github.com/rack/rack/pull/1463 for the potential fix

Actions #3

Updated by Go MAEDA about 4 years ago

  • Related to Defect #24646: X-Sendfile is missing in response headers added
Actions #4

Updated by Go MAEDA about 4 years ago

  • 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.

Actions #5

Updated by Go MAEDA about 4 years ago

  • Status changed from New to Closed
  • Assignee set to Go MAEDA
  • Resolution set to Fixed

Committed the fix.

Actions

Also available in: Atom PDF