Skip to content

Commit

Permalink
fix: use correct tag for js
Browse files Browse the repository at this point in the history
  • Loading branch information
spyderdfx committed Apr 20, 2018
1 parent 65a6556 commit ec43631
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions lib/string_tools.rb
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ def strip_all_tags_and_entities(string)
#
# Returns String
def strip_tags_leave_br(string)
sanitized = Sanitize.fragment(string, remove_contents: %w(style javascript), elements: %w(p ul li br blockquote))
sanitized = Sanitize.fragment(string, remove_contents: %w(style script), elements: %w(p ul li br blockquote))

sanitized.gsub!(/<(p|li|blockquote)[^>]*>/, '')
sanitized.gsub!(%r{<(br /|ul[^>]*|/[^>]*)>}, '<br />')
Expand Down Expand Up @@ -182,7 +182,7 @@ def sanitize(str, attrs = {})
:attributes => attributes,
:elements => elements,
:css => {:properties => Sanitize::Config::RELAXED[:css][:properties]},
:remove_contents => %w(style javascript),
:remove_contents => %w(style script),
:allow_comments => false,
:transformers => transformers
)
Expand Down
2 changes: 1 addition & 1 deletion spec/string_tools_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
end

it 'removes javascript from string' do
sanitized_string = described_class.sanitize('test string<javascript>alert("ALERT");</javascript>' )
sanitized_string = described_class.sanitize('test string<script>alert("ALERT");</script>')
expect(sanitized_string).to eq 'test string'
end

Expand Down

0 comments on commit ec43631

Please sign in to comment.