1
0
Fork 0
mirror of https://github.com/miniflux/v2.git synced 2025-08-06 17:41:00 +00:00

refactor(mediaproxy): simplify shouldProxy

The original function was non-trivial to understand, as `!A && (B || !C)` isn't
easily grokable by humans.
This commit is contained in:
jvoisin 2025-07-06 22:49:01 +02:00 committed by Frédéric Guillot
parent 052e8dd0aa
commit f864a2ed70

View file

@ -108,6 +108,14 @@ func proxifySourceSet(element *goquery.Selection, router *mux.Router, proxifyFun
}
func shouldProxy(attrValue, proxyOption string) bool {
return !strings.HasPrefix(attrValue, "data:") &&
(proxyOption == "all" || !urllib.IsHTTPS(attrValue))
if strings.HasPrefix(attrValue, "data:") {
return false
}
if proxyOption == "all" {
return true
}
if !urllib.IsHTTPS(attrValue) {
return true
}
return false
}