Skip to content

Commit

Permalink
fix lint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
EugeneTorap committed Apr 28, 2023
1 parent 369d68b commit 4ffd89f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
2 changes: 2 additions & 0 deletions superset/reports/notifications/email.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ def _get_content(self) -> EmailContent:
}

# Strip any malicious HTML from the description
# pylint: disable=no-member
description = nh3.clean(
self._content.description or "",
tags=ALLOWED_TAGS,
Expand All @@ -118,6 +119,7 @@ def _get_content(self) -> EmailContent:
# Strip malicious HTML from embedded data, allowing only table elements
if self._content.embedded_data is not None:
df = self._content.embedded_data
# pylint: disable=no-member
html_table = nh3.clean(
df.to_html(na_rep="", index=True, escape=True),
# pandas will escape the HTML in cells already, so passing
Expand Down
1 change: 1 addition & 0 deletions superset/utils/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -703,6 +703,7 @@ def markdown(raw: str, markup_wrap: Optional[bool] = False) -> str:
"markdown.extensions.codehilite",
],
)
# pylint: disable=no-member
safe = nh3.clean(safe, tags=safe_markdown_tags, attributes=safe_markdown_attrs)
if markup_wrap:
safe = Markup(safe)
Expand Down
5 changes: 4 additions & 1 deletion tests/unit_tests/notifications/email_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,5 +50,8 @@ def test_render_description_with_html() -> None:
._get_content()
.body
)
assert '<p>This is <a href="#" rel="noopener noreferrer">a test</a> alert</p><br>' in email_body
assert (
'<p>This is <a href="#" rel="noopener noreferrer">a test</a> alert</p><br>'
in email_body
)
assert '<td>&lt;a href="http://www.example.com"&gt;333&lt;/a&gt;</td>' in email_body

0 comments on commit 4ffd89f

Please sign in to comment.