github.com/kongr45gpen/mattermost-server@v5.11.1+incompatible/api4/image.go (about) 1 // Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved. 2 // See License.txt for license information. 3 4 package api4 5 6 import ( 7 "net/http" 8 ) 9 10 func (api *API) InitImage() { 11 api.BaseRoutes.Image.Handle("", api.ApiSessionRequiredTrustRequester(getImage)).Methods("GET") 12 } 13 14 func getImage(c *Context, w http.ResponseWriter, r *http.Request) { 15 if !*c.App.Config().ImageProxySettings.Enable { 16 http.NotFound(w, r) 17 return 18 } 19 20 c.App.ImageProxy.GetImage(w, r, r.URL.Query().Get("url")) 21 }