summaryrefslogtreecommitdiffstats
path: root/app/post.go
diff options
context:
space:
mode:
authorDerrick Anderson <derrick@andersonwebstudio.com>2018-02-12 15:09:59 -0500
committerDerrick Anderson <derrick@andersonwebstudio.com>2018-02-12 15:09:59 -0500
commitefd620d6c80ddc1f015811ec58514e34ee0b501b (patch)
tree8fdcc1043aba1c9a66382b915f4e185ade1128fb /app/post.go
parent87fb19b8279c86c72ffec623e55b80ce35b7d64f (diff)
parent1ae680aefae2deb1e9d07d7c2a1c863ec807a79f (diff)
downloadchat-efd620d6c80ddc1f015811ec58514e34ee0b501b.tar.gz
chat-efd620d6c80ddc1f015811ec58514e34ee0b501b.tar.bz2
chat-efd620d6c80ddc1f015811ec58514e34ee0b501b.zip
Merge branch 'release-4.7' into icu669
Diffstat (limited to 'app/post.go')
-rw-r--r--app/post.go10
1 files changed, 5 insertions, 5 deletions
diff --git a/app/post.go b/app/post.go
index f8a371fc0..1964bd3cf 100644
--- a/app/post.go
+++ b/app/post.go
@@ -922,6 +922,10 @@ func (a *App) imageProxyConfig() (proxyType, proxyURL, options, siteURL string)
proxyURL += "/"
}
+ if siteURL == "" || siteURL[len(siteURL)-1] != '/' {
+ siteURL += "/"
+ }
+
if cfg.ServiceSettings.ImageProxyOptions != nil {
options = *cfg.ServiceSettings.ImageProxyOptions
}
@@ -936,14 +940,10 @@ func (a *App) ImageProxyAdder() func(string) string {
}
return func(url string) string {
- if url == "" || strings.HasPrefix(url, proxyURL) {
+ if url == "" || url[0] == '/' || strings.HasPrefix(url, siteURL) || strings.HasPrefix(url, proxyURL) {
return url
}
- if url[0] == '/' {
- url = siteURL + url
- }
-
switch proxyType {
case "atmos/camo":
mac := hmac.New(sha1.New, []byte(options))