MM-23185 - Markdown image hosted by plugins are not shown if l… (#14185)

* avoid image proxy for local images

* added test for local images
Этот коммит содержится в:
Eli Yukelzon
2020-04-01 11:45:26 +03:00
коммит произвёл GitHub
родитель 005cc00ccc
Коммит 52c92d6659
3 изменённых файлов: 26 добавлений и 4 удалений

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

@@ -91,5 +91,14 @@ func TestGetImage(t *testing.T) {
respBody, err := ioutil.ReadAll(resp.Body)
require.NoError(t, err)
assert.Equal(t, "success", string(respBody))
// local images should not be proxied, but forwarded
r, err = http.NewRequest("GET", th.Client.ApiUrl+"/image?url=/plugins/test/image.png", nil)
require.NoError(t, err)
r.Header.Set(model.HEADER_AUTH, th.Client.AuthType+" "+th.Client.AuthToken)
resp, err = th.Client.HttpClient.Do(r)
require.NoError(t, err)
assert.Equal(t, http.StatusFound, resp.StatusCode)
})
}