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:
parent
9a9a271b1f
commit
864dd9f219
4 changed files with 34 additions and 3 deletions
|
@ -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">`
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue