Don't proxy same-site image urls (#8238)

* don't proxy same-site urls

* fix empty site url case
Этот коммит содержится в:
Chris
2018-02-09 15:41:06 -06:00
коммит произвёл GitHub
родитель a4e9499714
Коммит 396e7513ec
2 изменённых файлов: 16 добавлений и 2 удалений

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

@@ -190,6 +190,10 @@ func TestImageProxy(t *testing.T) {
th := Setup().InitBasic()
defer th.TearDown()
th.App.UpdateConfig(func(cfg *model.Config) {
*cfg.ServiceSettings.SiteURL = "http://mymattermost.com"
})
for name, tc := range map[string]struct {
ProxyType string
ProxyURL string
@@ -211,6 +215,12 @@ func TestImageProxy(t *testing.T) {
ImageURL: "http://mydomain.com/myimage",
ProxiedImageURL: "https://127.0.0.1/x1000/http://mydomain.com/myimage",
},
"willnorris/imageproxy_SameSite": {
ProxyType: "willnorris/imageproxy",
ProxyURL: "https://127.0.0.1",
ImageURL: "http://mymattermost.com/myimage",
ProxiedImageURL: "http://mymattermost.com/myimage",
},
"willnorris/imageproxy_EmptyImageURL": {
ProxyType: "willnorris/imageproxy",
ProxyURL: "https://127.0.0.1",