プロジェクト

全般

プロフィール

Vote #75324

完了

use test_email report can't modify frozen String

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

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

0%

予定工数:
category_id:
9
version_id:
85
issue_org_id:
17235
author_id:
104660
assigned_to_id:
0
comments:
4
status_id:
5
tracker_id:
1
plus1:
0
affected_version:
closed_on:
affected_version_id:
82
ステータス-->[Closed]

説明

version:
Environment:
Redmine version 2.5.1.stable
Ruby version 1.9.3-p545 (2014-02-24) [x86_64-linux]
Rails version 3.2.17
Environment production
Database adapter Mysql2
SCM:
Subversion 1.8.8
Git 1.9.0
Filesystem

Redmine plugins:
no plugin installed

call to : http://host/redmine/admin/test_email

exception:
RuntimeError (can't modify frozen String):
lib/redmine/codeset_util.rb:11:in force_encoding'
lib/redmine/codeset_util.rb:11:in
replace_invalid_utf8'
app/controllers/admin_controller.rb:68:in rescue in test_email'
app/controllers/admin_controller.rb:64:in
test_email'

fix:
I added str = str.dup @ line 11 in lib/redmine/codeset_util.rb (before str.force_encoding('UTF-8'))


journals

--------------------------------------------------------------------------------
Could you try this fix instead of your fix.

<pre><code class="diff">
diff --git a/app/controllers/admin_controller.rb b/app/controllers/admin_controller.rb
--- a/app/controllers/admin_controller.rb
+++ b/app/controllers/admin_controller.rb
@@ -65,7 +65,7 @@ class AdminController < ApplicationContr
@test = Mailer.test_email(User.current).deliver
flash[:notice] = l(:notice_email_sent, User.current.mail)
rescue Exception => e
- flash[:error] = l(:notice_email_error, Redmine::CodesetUtil.replace_invalid_utf8(e.message))
+ flash[:error] = l(:notice_email_error, Redmine::CodesetUtil.replace_invalid_utf8(e.message.dup))
end
ActionMailer::Base.raise_delivery_errors = raise_delivery_errors
redirect_to settings_path(:tab => 'notifications')

</code></pre>
--------------------------------------------------------------------------------
Toshi MARUYAMA wrote:
> Could you try this fix instead of your fix.
>
> [...]

Great! It works. I'm not a ruby programmer though, but I know it is a better fix :-)
--------------------------------------------------------------------------------
Committed in trunk r13198, 2.5-stable r13200 and 2.4-stable r13202.
--------------------------------------------------------------------------------

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

  • カテゴリEmail notifications_9 にセット
  • 対象バージョン2.4.6_85 にセット

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

いいね!0
いいね!0