Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allowed pattern is scrubbed #62

Open
Awlexus opened this issue May 9, 2023 · 1 comment
Open

Allowed pattern is scrubbed #62

Awlexus opened this issue May 9, 2023 · 1 comment

Comments

@Awlexus
Copy link

Awlexus commented May 9, 2023

I need a similar scrubber as the ones seen in the documentation, but when I try to create and scrub some text it also scrubs the pattern I allowed.

# custom scrubber
defmodule LinksOnlyScrubber do
  require HtmlSanitizeEx.Scrubber.Meta
  alias HtmlSanitizeEx.Scrubber.Meta

  Meta.remove_cdata_sections_before_scrub()
  Meta.strip_comments()

  Meta.allow_tag_with_uri_attributes("a", ["href"], ["https", "mailto", "http"])

  Meta.strip_everything_not_covered()
end

Actual result

The tag has been removed

iex> HtmlSanitizeEx.Scrubber.scrub "This is a <a href=\"https://www.youtube.com/\">test</a>", LinksOnlyScrubber
"This is a test"

Expected result

The text should be left untouched

Versions

html_sanitize_ex 1.4.2
mochiweb 2.22.0

jaimeiniesta added a commit to jaimeiniesta/html_sanitize_ex that referenced this issue Oct 29, 2024
@jaimeiniesta
Copy link

jaimeiniesta commented Oct 29, 2024

Hi, I've verified that allow_tag_with_uri_attributes is not working as expected.

Here's a test to reproduce the issue:

jaimeiniesta@6ddd1bf

Failing on my machine with:

  • Erlang/OTP 24 [erts-12.2] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1]
  • Elixir 1.13.4 (compiled with Erlang/OTP 24)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants