プロジェクト

全般

プロフィール

Vote #81395

完了

MailHandler raises NameError exception when generating error message

Admin Redmine さんが約4年前に追加. 約4年前に更新.

ステータス:
Closed
優先度:
通常
担当者:
-
カテゴリ:
Email receiving_29
対象バージョン:
開始日:
2022/05/09
期日:
進捗率:

0%

予定工数:
category_id:
29
version_id:
164
issue_org_id:
35100
author_id:
399232
assigned_to_id:
332
comments:
5
status_id:
5
tracker_id:
1
plus1:
0
affected_version:
closed_on:
affected_version_id:
127
ステータス-->[Closed]

説明

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?


journals

--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
attachment:35100-test.patch is a test code that catches the reported issue.
--------------------------------------------------------------------------------
Committed the fix. Thank you for reporting and fixing the issue.
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------

Admin Redmine さんが約4年前に更新

  • カテゴリEmail receiving_29 にセット
  • 対象バージョン4.1.3_164 にセット

他の形式にエクスポート: Atom PDF

いいね!0
いいね!0