From 0cd2895456f953ef871e10421361578b6c8d4add Mon Sep 17 00:00:00 2001 From: Chris Date: Thu, 1 Feb 2018 20:31:49 -0600 Subject: fix image url replacement for blank urls (#8184) --- app/post.go | 2 +- app/post_test.go | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) (limited to 'app') diff --git a/app/post.go b/app/post.go index bf4725e77..6890d1dd9 100644 --- a/app/post.go +++ b/app/post.go @@ -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 } diff --git a/app/post_test.go b/app/post_test.go index 9854bb707..3f3783265 100644 --- a/app/post_test.go +++ b/app/post_test.go @@ -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", -- cgit v1.2.3-1-g7c22