MM-58275 Ensure image proxy site URL is updated when that changes (#27214)

* MM-58275 Ensure image proxy site URL is updated when that changes

* Check if proxy settings changed using reflection
Этот коммит содержится в:
Harrison Healey
2024-06-04 14:06:37 -04:00
коммит произвёл GitHub
родитель 206ff6e697
Коммит 2bcaa42dc0
6 изменённых файлов: 127 добавлений и 41 удалений

Просмотреть файл

@@ -40,8 +40,6 @@ var msgNotAllowed = "requested URL is not allowed"
var ErrLocalRequestFailed = Error{errors.New("imageproxy.LocalBackend: failed to request proxied image")}
type LocalBackend struct {
proxy *ImageProxy
client *http.Client
baseURL *url.URL
}
@@ -57,15 +55,14 @@ func (e URLError) Error() string {
}
func makeLocalBackend(proxy *ImageProxy) *LocalBackend {
baseURL, err := url.Parse(*proxy.ConfigService.Config().ServiceSettings.SiteURL)
if err != nil {
mlog.Warn("Failed to set base URL for image proxy. Relative image links may not work.", mlog.Err(err))
baseURL := proxy.siteURL
if baseURL == nil {
mlog.Warn("Failed to set base URL for image proxy. Relative image links may not work.")
}
client := proxy.HTTPService.MakeClient(false)
return &LocalBackend{
proxy: proxy,
client: client,
baseURL: baseURL,
}