summaryrefslogtreecommitdiffstats
path: root/app/post.go
diff options
context:
space:
mode:
authorGeorge Goldberg <george@gberg.me>2018-02-13 13:35:52 +0000
committerGeorge Goldberg <george@gberg.me>2018-02-13 13:46:01 +0000
commit5c101253c5987743cf1b3a8fe68814d748070622 (patch)
treee2632505d051e7d15d6daf974ed8ac92095f82fe /app/post.go
parentb7fc3d7d35ca4dd16097715a66463392a1dfaf0a (diff)
parentd88d2bc2ed3aefa68b5ed2942f493ae42bb40bfa (diff)
downloadchat-5c101253c5987743cf1b3a8fe68814d748070622.tar.gz
chat-5c101253c5987743cf1b3a8fe68814d748070622.tar.bz2
chat-5c101253c5987743cf1b3a8fe68814d748070622.zip
Merge branch 'master' into advanced-permissions-phase-1
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 843319082..3f6252faa 100644
--- a/app/post.go
+++ b/app/post.go
@@ -869,6 +869,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
}
@@ -883,14 +887,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))