Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
OHR Support
Manage
Activity
Members
Labels
Plan
Issues
97
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Projects
OHR Support
Commits
21a45b4e
Commit
21a45b4e
authored
13 years ago
by
Holger Just
Browse files
Options
Downloads
Patches
Plain Diff
[#676] Enforce UTF-8 encodings on the params hash
Contributed by Toshi MARUYAMA
parent
2f4afeeb
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
app/controllers/application_controller.rb
+18
-0
18 additions, 0 deletions
app/controllers/application_controller.rb
with
18 additions
and
0 deletions
app/controllers/application_controller.rb
+
18
−
0
View file @
21a45b4e
...
...
@@ -43,6 +43,24 @@ class ApplicationController < ActionController::Base
end
end
# FIXME: Remove this when all of Rack and Rails have learned how to
# properly use encodings
before_filter
:params_filter
def
params_filter
self
.
utf8nize!
(
params
)
if
RUBY_VERSION
>=
'1.9'
end
def
utf8nize!
(
obj
)
if
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
)}
elsif
obj
.
is_a?
Array
obj
.
each
{
|
v
|
self
.
utf8nize!
(
v
)}
else
obj
end
end
before_filter
:user_setup
,
:check_if_login_required
,
:set_localization
filter_parameter_logging
:password
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment