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

Handle srcset images with no space after comma

This commit is contained in:
Frédéric Guillot 2021-10-13 21:27:39 -07:00 committed by fguillot
parent c2c9db737b
commit 5f9d6fd81b
2 changed files with 14 additions and 18 deletions

View file

@ -19,7 +19,7 @@ import (
var (
youtubeEmbedRegex = regexp.MustCompile(`//www\.youtube\.com/embed/(.*)`)
splitSrcsetRegex = regexp.MustCompile(`,\s+`)
splitSrcsetRegex = regexp.MustCompile(`,\s?`)
)
// Sanitize returns safe HTML.
@ -457,13 +457,9 @@ func sanitizeSrcsetAttr(baseURL, value string) string {
nbParts := len(parts)
if nbParts > 0 {
sanitizedSource := parts[0]
if !strings.HasPrefix(parts[0], "data:") {
var err error
sanitizedSource, err = url.AbsoluteURL(baseURL, parts[0])
if err != nil {
continue
}
sanitizedSource, err := url.AbsoluteURL(baseURL, parts[0])
if err != nil {
continue
}
if nbParts == 2 && isValidWidthOrDensityDescriptor(parts[1]) {