Skip to content

Commit

Permalink
Merge pull request #31 from spyderdfx/feature/GOODS-1246
Browse files Browse the repository at this point in the history
fix: use correct tag for js
  • Loading branch information
cynek authored Apr 20, 2018
2 parents d984ddd + d6198f7 commit 7a7fa7d
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 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 lib/string_tools/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module StringTools
VERSION = '0.11.0'.freeze
VERSION = '0.11.1'.freeze
end
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 7a7fa7d

Please sign in to comment.