Project

General

Profile

Actions

Defect #42962

closed

Mail handler fails to create issues from emails over 4MB on Rack >= 3.1.14

Added by Go MAEDA about 8 hours ago. Updated about 5 hours ago.

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

0%

Estimated time:
Resolution:
Fixed
Affected version:

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

42962.patch (1.26 KB) 42962.patch Go MAEDA, 2025-07-06 06:48

Related issues

Related to Redmine - Defect #42875: "Page not found" error when saving workflows with many statuses on Rack >= 3.1.14ClosedGo MAEDA

Actions
Actions #1

Updated by Go MAEDA about 6 hours ago

Here is a patch to fix the issue.

Actions #2

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
Actions #3

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.

Actions #4

Updated by Go MAEDA about 5 hours ago

  • Status changed from Resolved to Closed

Merged the change into the stable branches in r23866, r23867, and r23868.

Actions

Also available in: Atom PDF