1
0
Fork 0
mirror of https://github.com/miniflux/v2.git synced 2025-08-16 18:01:37 +00:00

Do not convert anchors to absolute links

This commit is contained in:
Frédéric Guillot 2022-09-11 22:32:16 -07:00
parent 183cb491b3
commit 138fd926ee
2 changed files with 37 additions and 17 deletions

View file

@ -203,6 +203,16 @@ func TestIFrameWithChildElements(t *testing.T) {
}
}
func TestAnchorLink(t *testing.T) {
input := `<p>This link is <a href="#some-anchor">an anchor</a></p>`
expected := `<p>This link is <a href="#some-anchor">an anchor</a></p>`
output := Sanitize("http://example.org/", input)
if expected != output {
t.Errorf(`Wrong output: "%s" != "%s"`, expected, output)
}
}
func TestInvalidURLScheme(t *testing.T) {
input := `<p>This link is <a src="file:///etc/passwd">not valid</a></p>`
expected := `<p>This link is not valid</p>`