mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
minor addition to #8238
This commit is contained in:
@@ -894,14 +894,10 @@ func (a *App) ImageProxyAdder() func(string) string {
|
||||
}
|
||||
|
||||
return func(url string) string {
|
||||
if url == "" || strings.HasPrefix(url, siteURL) || strings.HasPrefix(url, proxyURL) {
|
||||
if url == "" || url[0] == '/' || strings.HasPrefix(url, siteURL) || strings.HasPrefix(url, proxyURL) {
|
||||
return url
|
||||
}
|
||||
|
||||
if url[0] == '/' {
|
||||
url = siteURL + url[1:]
|
||||
}
|
||||
|
||||
switch proxyType {
|
||||
case "atmos/camo":
|
||||
mac := hmac.New(sha1.New, []byte(options))
|
||||
|
||||
@@ -221,6 +221,12 @@ func TestImageProxy(t *testing.T) {
|
||||
ImageURL: "http://mymattermost.com/myimage",
|
||||
ProxiedImageURL: "http://mymattermost.com/myimage",
|
||||
},
|
||||
"willnorris/imageproxy_PathOnly": {
|
||||
ProxyType: "willnorris/imageproxy",
|
||||
ProxyURL: "https://127.0.0.1",
|
||||
ImageURL: "/myimage",
|
||||
ProxiedImageURL: "/myimage",
|
||||
},
|
||||
"willnorris/imageproxy_EmptyImageURL": {
|
||||
ProxyType: "willnorris/imageproxy",
|
||||
ProxyURL: "https://127.0.0.1",
|
||||
|
||||
Reference in New Issue
Block a user