summaryrefslogtreecommitdiffstats
path: root/app/controllers
diff options
context:
space:
mode:
authorToshi MARUYAMA <marutosijp2@yahoo.co.jp>2012-01-28 10:26:34 +0000
committerToshi MARUYAMA <marutosijp2@yahoo.co.jp>2012-01-28 10:26:34 +0000
commitd4d27bd2d8b57e5d2597b75fbb7b963b6c3e37f7 (patch)
treef491170e6d1228b8f567d819ea78507e3d2b4ab2 /app/controllers
parent189bc0f7c8f629ace64333e3c4c1a26da5e4b799 (diff)
downloadredmine-d4d27bd2d8b57e5d2597b75fbb7b963b6c3e37f7.tar.gz
redmine-d4d27bd2d8b57e5d2597b75fbb7b963b6c3e37f7.zip
Ruby1.9: skip enforcing UTF-8 encodings on the params hash on Rails2 if it is frozen (#4050, #4796)
Tests on CI server fail. http://www.redmine.org/builds/build_trunk-1.9.2-sqlite3_257.html <pre> 1) Error: test_index_with_short_filters(IssuesControllerTest): RuntimeError: can't modify frozen string /var/lib/hudson/jobs/trunk-1.9.2-sqlite3/workspace/app/controllers/application_controller.rb:58:in `force_encoding' /var/lib/hudson/jobs/trunk-1.9.2-sqlite3/workspace/app/controllers/application_controller.rb:58:in `utf8nize!' /var/lib/hudson/jobs/trunk-1.9.2-sqlite3/workspace/app/controllers/application_controller.rb:60:in `block in utf8nize!' /var/lib/hudson/jobs/trunk-1.9.2-sqlite3/workspace/app/controllers/application_controller.rb:60:in `each' /var/lib/hudson/jobs/trunk-1.9.2-sqlite3/workspace/app/controllers/application_controller.rb:60:in `utf8nize!' /var/lib/hudson/jobs/trunk-1.9.2-sqlite3/workspace/app/controllers/application_controller.rb:52:in `params_filter' /var/lib/hudson/ruby1.9.2/lib/ruby/gems/1.9.1/gems/activesupport-2.3.14/lib/active_support/callbacks.rb:178:in `evaluate_method' /var/lib/hudson/ruby1.9.2/lib/ruby/gems/1.9.1/gems/activesupport-2.3.14/lib/active_support/callbacks.rb:166:in `call' /var/lib/hudson/ruby1.9.2/lib/ruby/gems/1.9.1/gems/actionpack-2.3.14/lib/action_controller/filters.rb:225:in `call' /var/lib/hudson/ruby1.9.2/lib/ruby/gems/1.9.1/gems/actionpack-2.3.14/lib/action_controller/filters.rb:629:in `run_before_filters' /var/lib/hudson/ruby1.9.2/lib/ruby/gems/1.9.1/gems/actionpack-2.3.14/lib/action_controller/filters.rb:615:in `call_filters' /var/lib/hudson/ruby1.9.2/lib/ruby/gems/1.9.1/gems/actionpack-2.3.14/lib/action_controller/filters.rb:610:in `perform_action_with_filters' /var/lib/hudson/ruby1.9.2/lib/ruby/gems/1.9.1/gems/actionpack-2.3.14/lib/action_controller/benchmarking.rb:68:in `block in perform_action_with_benchmark' /var/lib/hudson/ruby1.9.2/lib/ruby/gems/1.9.1/gems/activesupport-2.3.14/lib/active_support/core_ext/benchmark.rb:17:in `block in ms' </pre> git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@8716 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/controllers')
-rw-r--r--app/controllers/application_controller.rb4
1 files changed, 3 insertions, 1 deletions
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index a0fa5c4af..a087b82ee 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -54,7 +54,9 @@ class ApplicationController < ActionController::Base
end
def utf8nize!(obj)
- if obj.is_a? String
+ if obj.frozen?
+ obj
+ elsif obj.is_a? String
obj.respond_to?(:force_encoding) ? obj.force_encoding("UTF-8") : obj
elsif obj.is_a? Hash
obj.each {|k, v| obj[k] = self.utf8nize!(v)}