if EnableLinkPreviews not enabled, do not call url (#9461)
Этот коммит содержится в:
коммит произвёл
Jesús Espino
родитель
328d9a55ee
Коммит
3e462713de
@@ -451,6 +451,13 @@ func testS3(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
func getRedirectLocation(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
m := make(map[string]string)
|
||||
m["location"] = ""
|
||||
cfg := c.App.GetConfig()
|
||||
if !*cfg.ServiceSettings.EnableLinkPreviews {
|
||||
w.Write([]byte(model.MapToJson(m)))
|
||||
return
|
||||
}
|
||||
url := r.URL.Query().Get("url")
|
||||
if len(url) == 0 {
|
||||
c.SetInvalidParam("url")
|
||||
@@ -463,9 +470,6 @@ func getRedirectLocation(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
},
|
||||
}
|
||||
|
||||
m := make(map[string]string)
|
||||
m["location"] = ""
|
||||
|
||||
res, err := client.Head(url)
|
||||
if err != nil {
|
||||
// Always return a success status and a JSON string to limit the amount of information returned to a
|
||||
|
||||
Ссылка в новой задаче
Block a user