mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Merge pull request #10839 from gsamokovarov/clean-normalize_encoded_paths
Refactor ActionDispatch::Http::Parameters#normalize_encode_params
This commit is contained in:
commit
bc8f802623
1 changed files with 7 additions and 11 deletions
|
@ -64,17 +64,13 @@ module ActionDispatch
|
||||||
end
|
end
|
||||||
|
|
||||||
new_hash = {}
|
new_hash = {}
|
||||||
params.each do |k, v|
|
params.each do |key, val|
|
||||||
new_key = k.is_a?(String) ? k.dup.force_encoding(Encoding::UTF_8).encode! : k
|
new_key = key.is_a?(String) ? key.dup.force_encoding(Encoding::UTF_8).encode! : key
|
||||||
new_hash[new_key] =
|
new_hash[new_key] = if val.is_a?(Array)
|
||||||
case v
|
val.map! { |el| normalize_encode_params(el) }
|
||||||
when Hash
|
else
|
||||||
normalize_encode_params(v)
|
normalize_encode_params(val)
|
||||||
when Array
|
end
|
||||||
v.map! {|el| normalize_encode_params(el) }
|
|
||||||
else
|
|
||||||
normalize_encode_params(v)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
new_hash.with_indifferent_access
|
new_hash.with_indifferent_access
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue