1
0
Fork 0
mirror of https://github.com/miniflux/v2.git synced 2025-08-31 18:31:01 +00:00

fix: video poster image URL is encoded twice when using MEDIA_PROXY_MODE=all

This commit is contained in:
wangb 2024-07-14 00:20:55 +08:00 committed by GitHub
parent 4ca19d123a
commit f847c3e754
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 34 additions and 6 deletions

View file

@ -4,6 +4,7 @@
package mediaproxy // import "miniflux.app/v2/internal/mediaproxy"
import (
"slices"
"strings"
"miniflux.app/v2/internal/config"
@ -53,13 +54,15 @@ func genericProxyRewriter(router *mux.Router, proxifyFunction urlProxyRewriter,
}
})
doc.Find("video").Each(func(i int, video *goquery.Selection) {
if posterAttrValue, ok := video.Attr("poster"); ok {
if shouldProxy(posterAttrValue, proxyOption) {
video.SetAttr("poster", proxifyFunction(router, posterAttrValue))
if !slices.Contains(config.Opts.MediaProxyResourceTypes(), "video") {
doc.Find("video").Each(func(i int, video *goquery.Selection) {
if posterAttrValue, ok := video.Attr("poster"); ok {
if shouldProxy(posterAttrValue, proxyOption) {
video.SetAttr("poster", proxifyFunction(router, posterAttrValue))
}
}
}
})
})
}
case "audio":
doc.Find("audio, audio source").Each(func(i int, audio *goquery.Selection) {