diff options
author | Jesse Haka <haka.jesse@gmail.com> | 2018-10-02 09:00:50 +0300 |
---|---|---|
committer | Jesús Espino <jespinog@gmail.com> | 2018-10-02 08:00:50 +0200 |
commit | 3e462713debd5c992aa071bed902110bed88ec67 (patch) | |
tree | 983523b496897a1e39a38828e6db8401c79f70b2 /api4/system.go | |
parent | 328d9a55ee9bec51b5e36f64920bf8d4d59aeee2 (diff) | |
download | chat-3e462713debd5c992aa071bed902110bed88ec67.tar.gz chat-3e462713debd5c992aa071bed902110bed88ec67.tar.bz2 chat-3e462713debd5c992aa071bed902110bed88ec67.zip |
if EnableLinkPreviews not enabled, do not call url (#9461)
Diffstat (limited to 'api4/system.go')
-rw-r--r-- | api4/system.go | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/api4/system.go b/api4/system.go index 2f6e53ab8..ddeac4df4 100644 --- a/api4/system.go +++ b/api4/system.go @@ -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 |