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

Handle more encoding edge cases

- Feeds with charset specified only in Content-Type header and not in XML document
- Feeds with charset specified in both places
- Feeds with charset specified only in XML document and not in HTTP header
This commit is contained in:
Frédéric Guillot 2018-01-19 22:42:55 -08:00
parent 3b62f904d6
commit 713b38e34c
10 changed files with 87 additions and 21 deletions

View file

@ -35,8 +35,13 @@ func FindSubscriptions(websiteURL string) (Subscriptions, error) {
return nil, errors.NewLocalizedError(errConnectionFailure, err)
}
body, err := response.NormalizeBodyEncoding()
if err != nil {
return nil, err
}
var buffer bytes.Buffer
io.Copy(&buffer, response.Body)
io.Copy(&buffer, body)
reader := bytes.NewReader(buffer.Bytes())
if format := feed.DetectFeedFormat(reader); format != feed.FormatUnknown {