|
|
@@ -709,7 +709,7 @@ func TestImageSrcWithTrackers(t *testing.T) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-func TestPixelTracker(t *testing.T) {
|
|
|
+func Test1x1PixelTracker(t *testing.T) {
|
|
|
input := `<p><img src="https://tracker1.example.org/" height="1" width="1"> and <img src="https://tracker2.example.org/" height="1" width="1"/></p>`
|
|
|
expected := `<p> and </p>`
|
|
|
output := SanitizeHTMLWithDefaultOptions("http://example.org/", input)
|
|
|
@@ -719,6 +719,16 @@ func TestPixelTracker(t *testing.T) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+func Test0x0PixelTracker(t *testing.T) {
|
|
|
+ input := `<p><img src="https://tracker1.example.org/" height="0" width="0"> and <img src="https://tracker2.example.org/" height="0" width="0"/></p>`
|
|
|
+ expected := `<p> and </p>`
|
|
|
+ output := SanitizeHTMLWithDefaultOptions("http://example.org/", input)
|
|
|
+
|
|
|
+ if expected != output {
|
|
|
+ t.Errorf(`Wrong output: "%s" != "%s"`, expected, output)
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
func TestXmlEntities(t *testing.T) {
|
|
|
input := `<pre>echo "test" > /etc/hosts</pre>`
|
|
|
expected := `<pre>echo "test" > /etc/hosts</pre>`
|