diff options
author | 2019-09-18 22:27:25 -0700 | |
---|---|---|
committer | 2019-09-18 22:45:56 -0700 | |
commit | 36d773223481dd42d31499b3ea73e6999ff9f58e (patch) | |
tree | a122e207303b2fa33b334dbe19e57a508a955a25 /reader/atom/parser_test.go | |
parent | ca48f7612ada5d64d1097c40321a919eb28eb2bf (diff) | |
download | v2-36d773223481dd42d31499b3ea73e6999ff9f58e.tar.gz v2-36d773223481dd42d31499b3ea73e6999ff9f58e.tar.zst v2-36d773223481dd42d31499b3ea73e6999ff9f58e.zip |
Disable strict XML parsing
This change should improve parsing of broken XML feeds.
See https://golang.org/pkg/encoding/xml/#Decoder
Diffstat (limited to 'reader/atom/parser_test.go')
-rw-r--r-- | reader/atom/parser_test.go | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/reader/atom/parser_test.go b/reader/atom/parser_test.go index dc425751..746c767a 100644 --- a/reader/atom/parser_test.go +++ b/reader/atom/parser_test.go @@ -577,3 +577,22 @@ func TestParseWithHTMLEntity(t *testing.T) { t.Errorf(`Incorrect title, got: %q`, feed.Title) } } + +func TestParseWithInvalidCharacterEntity(t *testing.T) { + data := ` + <?xml version="1.0" encoding="utf-8"?> + <feed xmlns="http://www.w3.org/2005/Atom"> + <title>Example Feed</title> + <link href="http://example.org/a&b"/> + </feed> + ` + + feed, err := Parse(bytes.NewBufferString(data)) + if err != nil { + t.Fatal(err) + } + + if feed.SiteURL != "http://example.org/a&b" { + t.Errorf(`Incorrect URL, got: %q`, feed.SiteURL) + } +} |