Skip to content

Commit

Permalink
fix test + linting errors
Browse files Browse the repository at this point in the history
  • Loading branch information
tibvdm committed Aug 25, 2023
1 parent 545cab4 commit 03fe6b7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions app/helpers/application_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -145,11 +145,11 @@ def markdown_unsafe(source)

def sanitize(html)
@tags ||= Rails::Html::SafeListSanitizer.allowed_tags.to_a +
%w[table thead tbody tr td th colgroup col style summary details] +
%w[svg g style circle line rect path polygon text]
%w[table thead tbody tr td th colgroup col style summary details] +
%w[svg g style circle line rect path polygon text]
@attributes ||= Rails::Html::SafeListSanitizer.allowed_attributes.to_a +
%w[style target data-bs-toggle data-parent data-tab data-line data-element id] +
%w[viewbox width height version style class transform id x y rx ry x1 y1 x2 y2 d points fill stroke stroke-width cx cy r font-size font-family font-weight font-variant]
%w[style target data-bs-toggle data-parent data-tab data-line data-element id] +
%w[viewbox width height version style class transform id x y rx ry x1 y1 x2 y2 d points fill stroke stroke-width cx cy r font-size font-family font-weight font-variant]

# Filters allowed tags and attributes
sanitized = ActionController::Base.helpers.sanitize html,
Expand Down
2 changes: 1 addition & 1 deletion test/helpers/application_helper_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ class ApplicationHelperTest < ActiveSupport::TestCase

test 'sanitize helper should allow a selection of svg tags' do
dirty_html = <<~HTML
<svg viewbox="0 0 100 100" xmlns="http://www.w3.org/2000/svg" width="300" height="100" version="1.1">
<svg viewbox="0 0 100 100" width="300" height="100" version="1.1">
<style>line,circle{stroke-width:3px;stroke:black;stroke-linecap:round}</style>
<style>test{stroke-width:3px;stroke:black;stroke-linecap:round}</style>
<g id="group1" transform="translate(50,50)">
Expand Down

0 comments on commit 03fe6b7

Please sign in to comment.