Defect #42962
closedMail handler fails to create issues from emails over 4MB on Rack >= 3.1.14
0%
Description
When using Rack 3.1.14 or later, creating an issue from an incoming email fails if the email message exceeds 4MB.
This is because starting with Rack 3.1.4, a limit was introduced on the query string size, with a default of 4MB. However, this is too small for handling emails. For example, attaching even a single smartphone photo (typically 5–10MB) can exceed the limit and cause issue creation to fail.
The limit can be raised by setting the RACK_QUERY_PARSER_BYTESIZE_LIMIT
environment variable. I suggest Redmine adopt a higher default, such as 32MB (33554432). Since email attachments are usually Base64-encoded, adding about 33% overhead, this setting would allow emails with attachments up to roughly 24-25MB. That covers several high-resolution photos or a single PowerPoint file, which often ranges from 10–20MB.
diff --git a/config/boot.rb b/config/boot.rb
index 72ea699a5..1363e9e75 100644
--- a/config/boot.rb
+++ b/config/boot.rb
@@ -11,6 +11,8 @@
# - https://github.com/rack/rack/blob/v3.1.16/lib/rack/query_parser.rb#L57
ENV['RACK_QUERY_PARSER_PARAMS_LIMIT'] ||= '65536'
+ENV['RACK_QUERY_PARSER_BYTESIZE_LIMIT'] ||= '33554432'
+
# Set up gems listed in the Gemfile.
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
Files
Related issues
Updated by Go MAEDA about 6 hours ago
- File 42962.patch 42962.patch added
Here is a patch to fix the issue.
Updated by Go MAEDA about 5 hours ago
- Related to Defect #42875: "Page not found" error when saving workflows with many statuses on Rack >= 3.1.14 added
Updated by Go MAEDA about 5 hours ago
- Status changed from New to Resolved
- Assignee set to Go MAEDA
- Resolution set to Fixed
Committed the fix in r23865.