MM-14686 Send all image proxy requests through /api/v4/image (#10775)

* MM-14686 Implement /api/v4/image when proxy is disabled

* MM-14686 Send all image proxy requests through /api/v4/image

* Update unit tests
Этот коммит содержится в:
Harrison Healey
2019-05-06 09:22:37 -04:00
коммит произвёл GitHub
родитель 4552c20d5b
Коммит dce6cb601f
10 изменённых файлов: 128 добавлений и 213 удалений

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

@@ -12,10 +12,11 @@ func (api *API) InitImage() {
}
func getImage(c *Context, w http.ResponseWriter, r *http.Request) {
if !*c.App.Config().ImageProxySettings.Enable {
http.NotFound(w, r)
return
}
url := r.URL.Query().Get("url")
c.App.ImageProxy.GetImage(w, r, r.URL.Query().Get("url"))
if *c.App.Config().ImageProxySettings.Enable {
c.App.ImageProxy.GetImage(w, r, url)
} else {
http.Redirect(w, r, url, http.StatusFound)
}
}