mirror of
https://github.com/miniflux/v2.git
synced 2025-07-12 16:58:36 +00:00
Improve sanitizer to remove style tag contents.
See #157. Refactored how blacklisted tags are handled so they're easier manage in the future.
This commit is contained in:
parent
d847b10e32
commit
c9131b0e89
2 changed files with 31 additions and 8 deletions
|
@ -232,3 +232,13 @@ func TestReplaceScript(t *testing.T) {
|
|||
t.Errorf(`Wrong output: "%s" != "%s"`, expected, output)
|
||||
}
|
||||
}
|
||||
|
||||
func TestReplaceStyle(t *testing.T) {
|
||||
input := `<p>Before paragraph.</p><style>body { background-color: #ff0000; }</style><p>After paragraph.</p>`
|
||||
expected := `<p>Before paragraph.</p><p>After paragraph.</p>`
|
||||
output := Sanitize("http://example.org/", input)
|
||||
|
||||
if expected != output {
|
||||
t.Errorf(`Wrong output: "%s" != "%s"`, expected, output)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue