1
0
mirror of https://github.com/imgproxy/imgproxy.git synced 2025-02-07 11:36:25 +02:00
imgproxy/security/source.go
2021-05-07 17:10:21 +06:00

20 lines
315 B
Go

package security
import (
"strings"
"github.com/imgproxy/imgproxy/v2/config"
)
func VerifySourceURL(imageURL string) bool {
if len(config.AllowedSources) == 0 {
return true
}
for _, val := range config.AllowedSources {
if strings.HasPrefix(imageURL, string(val)) {
return true
}
}
return false
}