Commit 03b628dfa26f7d584ca44b3264469f0b96e2c2c9
Committed by
Carlos Purificação
1 parent
c062dee3
Exists in
theme-brasil-digital-from-staging
and in
9 other branches
Individualize params for sanitize_params library. Preparing for API call
Showing
1 changed file
with
7 additions
and
2 deletions
Show diff stats
lib/sanitize_params.rb
... | ... | @@ -5,13 +5,18 @@ module SanitizeParams |
5 | 5 | # Check each request parameter for |
6 | 6 | # improper HTML or Script tags |
7 | 7 | def sanitize_params |
8 | - request.params.each { |k, v| | |
8 | + sanitize_params(request.params) | |
9 | + end | |
10 | + | |
11 | + # Given a params list sanitize all | |
12 | + def sanitize_params(params) | |
13 | + params.each { |k, v| | |
9 | 14 | if v.is_a?(String) |
10 | 15 | params[k] = sanitize_param v |
11 | 16 | elsif v.is_a?(Array) |
12 | 17 | params[k] = sanitize_array v |
13 | 18 | end |
14 | - } | |
19 | + } | |
15 | 20 | end |
16 | 21 | |
17 | 22 | # If the parameter was an array, | ... | ... |