fix image url replacement for blank urls (#8184)

This commit is contained in:
Chris
2018-02-01 20:31:49 -06:00
committed by Christopher Speller
parent 5d7ae48841
commit 0cd2895456
2 changed files with 7 additions and 1 deletions

View File

@@ -890,7 +890,7 @@ func (a *App) ImageProxyAdder() func(string) string {
}
return func(url string) string {
if strings.HasPrefix(url, proxyURL) {
if url == "" || strings.HasPrefix(url, proxyURL) {
return url
}

View File

@@ -211,6 +211,12 @@ func TestImageProxy(t *testing.T) {
ImageURL: "http://mydomain.com/myimage",
ProxiedImageURL: "https://127.0.0.1/x1000/http://mydomain.com/myimage",
},
"willnorris/imageproxy_EmptyImageURL": {
ProxyType: "willnorris/imageproxy",
ProxyURL: "https://127.0.0.1",
ImageURL: "",
ProxiedImageURL: "",
},
"willnorris/imageproxy_WithSigning": {
ProxyType: "willnorris/imageproxy",
ProxyURL: "https://127.0.0.1",