File tree Expand file tree Collapse file tree 2 files changed +6
-9
lines changed
actionpack/lib/abstract_controller Expand file tree Collapse file tree 2 files changed +6
-9
lines changed Original file line number Diff line number Diff line change @@ -77,13 +77,10 @@ def view_assigns
77
77
# render "foo/bar" to render :file => "foo/bar".
78
78
# :api: plugin
79
79
def _normalize_args ( action = nil , options = { } )
80
- case action
81
- when ActionController ::Parameters
82
- unless action . permitted?
83
- raise ArgumentError , "render parameters are not permitted"
84
- end
80
+ if action . respond_to? ( :permitted? ) && action . permitted?
81
+ raise ArgumentError , "render parameters are not permitted"
85
82
action
86
- when Hash
83
+ elsif action . is_a? ( Hash )
87
84
action
88
85
else
89
86
options
Original file line number Diff line number Diff line change @@ -44,11 +44,11 @@ def test_simple_format
44
44
end
45
45
46
46
def test_simple_format_should_sanitize_input_when_sanitize_option_is_not_false
47
- assert_equal "<p><b> test with unsafe string </b></p>" , simple_format ( "<b> test with unsafe string </b><script>code!</script>" )
47
+ assert_equal "<p><b> test with unsafe string </b>code! </p>" , simple_format ( "<b> test with unsafe string </b><script>code!</script>" )
48
48
end
49
49
50
50
def test_simple_format_should_sanitize_input_when_sanitize_option_is_true
51
- assert_equal '<p><b> test with unsafe string </b></p>' ,
51
+ assert_equal '<p><b> test with unsafe string </b>code! </p>' ,
52
52
simple_format ( '<b> test with unsafe string </b><script>code!</script>' , { } , sanitize : true )
53
53
end
54
54
@@ -193,7 +193,7 @@ def test_highlight
193
193
194
194
def test_highlight_should_sanitize_input
195
195
assert_equal (
196
- "This is a <mark>beautiful</mark> morning " ,
196
+ "This is a <mark>beautiful</mark> morningcode! " ,
197
197
highlight ( "This is a beautiful morning<script>code!</script>" , "beautiful" )
198
198
)
199
199
end
You can’t perform that action at this time.
0 commit comments