Defect #35100
MailHandler raises NameError exception when generating error message
Status: | Closed | Start date: | ||
---|---|---|---|---|
Priority: | Normal | Due date: | ||
Assignee: | % Done: | 0% | ||
Category: | Email receiving | |||
Target version: | 4.1.3 | |||
Resolution: | Fixed | Affected version: | 4.1.0 |
Description
Issue #31899 improved errors clarity but it's actually broken. Instead raising UnauthorizedAction
its getting Uninitialized variable
because project
is not defined at lines:
source:trunk/app/models/mail_handler.rb#L230
source:trunk/app/models/mail_handler.rb#L279
Here the fix:
UTF-8
===================================================================
diff --git a/app/models/mail_handler.rb b/app/models/mail_handler.rb
--- a/app/models/mail_handler.rb (revision 8a2fa565e2bbe8667e6509755769343a7c69fcd3)
+++ b/app/models/mail_handler.rb (date 1618469355034)
@@ -227,7 +227,7 @@
unless handler_options[:no_permission_check]
unless user.allowed_to?(:add_issue_notes, issue.project) ||
user.allowed_to?(:edit_issues, issue.project)
- raise UnauthorizedAction, "not allowed to add notes on issues to project [#{project.name}]"
+ raise UnauthorizedAction, "not allowed to add notes on issues to project [#{issue.project.name}]"
end
end
@@ -282,7 +282,7 @@
end
unless handler_options[:no_permission_check]
- raise UnauthorizedAction, "not allowed to add messages to project [#{project.name}]" unless user.allowed_to?(:add_messages, message.project)
+ raise UnauthorizedAction, "not allowed to add messages to project [#{message.project.name}]" unless user.allowed_to?(:add_messages, message.project)
end
if !message.locked?
Associated revisions
MailHandler raises NameError exception when generating error message (#35100).
Patch by Dmitry Makurin and Go MAEDA.
History
#1
Updated by Marius BALTEANU over 1 year ago
- Target version set to 4.1.3
#2
Updated by Marius BALTEANU over 1 year ago
- Affected version set to 4.1.0
#3
Updated by Go MAEDA over 1 year ago
- File 35100-test.patch
added
- Status changed from New to Confirmed
35100-test.patch is a test code that catches the reported issue.
#4
Updated by Go MAEDA over 1 year ago
- Subject changed from Fix MailHandler errors message to MailHandler raises NameError exception when generating error message
- Category set to Email receiving
- Status changed from Confirmed to Resolved
- Assignee set to Go MAEDA
- Resolution set to Fixed
Committed the fix. Thank you for reporting and fixing the issue.
#5
Updated by Go MAEDA over 1 year ago
- Status changed from Resolved to Closed