minor addition to #8238
Этот коммит содержится в:
@@ -894,14 +894,10 @@ func (a *App) ImageProxyAdder() func(string) string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return func(url 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
|
return url
|
||||||
}
|
}
|
||||||
|
|
||||||
if url[0] == '/' {
|
|
||||||
url = siteURL + url[1:]
|
|
||||||
}
|
|
||||||
|
|
||||||
switch proxyType {
|
switch proxyType {
|
||||||
case "atmos/camo":
|
case "atmos/camo":
|
||||||
mac := hmac.New(sha1.New, []byte(options))
|
mac := hmac.New(sha1.New, []byte(options))
|
||||||
|
|||||||
@@ -221,6 +221,12 @@ func TestImageProxy(t *testing.T) {
|
|||||||
ImageURL: "http://mymattermost.com/myimage",
|
ImageURL: "http://mymattermost.com/myimage",
|
||||||
ProxiedImageURL: "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": {
|
"willnorris/imageproxy_EmptyImageURL": {
|
||||||
ProxyType: "willnorris/imageproxy",
|
ProxyType: "willnorris/imageproxy",
|
||||||
ProxyURL: "https://127.0.0.1",
|
ProxyURL: "https://127.0.0.1",
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user