1
0
Fork 0
mirror of https://github.com/miniflux/v2.git synced 2025-07-17 17:08:36 +00:00

Allow images with data URLs

Only URLs with a mime-type image/* are allowed
This commit is contained in:
Frédéric Guillot 2021-02-06 14:33:28 -08:00 committed by fguillot
parent 9a9a271b1f
commit 864dd9f219
4 changed files with 34 additions and 3 deletions

View file

@ -15,6 +15,16 @@ func TestValidInput(t *testing.T) {
}
}
func TestImgWithTextDataURL(t *testing.T) {
input := `<img src="data:text/plain;base64,SGVsbG8sIFdvcmxkIQ==" alt="Example">`
expected := ``
output := Sanitize("http://example.org/", input)
if output != expected {
t.Errorf(`Wrong output: %s`, output)
}
}
func TestImgWithDataURL(t *testing.T) {
input := `<img src="data:image/gif;base64,test" alt="Example">`
expected := `<img src="data:image/gif;base64,test" alt="Example" loading="lazy">`