diff options
author | Frédéric Guillot <fred@miniflux.net> | 2017-12-18 18:06:53 -0800 |
---|---|---|
committer | Frédéric Guillot <fred@miniflux.net> | 2017-12-18 18:06:53 -0800 |
commit | ce75748cf25d05f795b0ec8c659824345c7f3868 (patch) | |
tree | 494f503ca58589e36d8b333df7828e9a7377f2d8 | |
parent | 99dc590e459eb760a3aae963226ff843c2f51917 (diff) |
Use base64 URL encoding instead of standard encoding
-rw-r--r-- | server/ui/controller/proxy.go | 2 | ||||
-rw-r--r-- | server/ui/filter/image_proxy_filter.go | 3 |
2 files changed, 3 insertions, 2 deletions
diff --git a/server/ui/controller/proxy.go b/server/ui/controller/proxy.go index b44eddc..6d3f518 100644 --- a/server/ui/controller/proxy.go +++ b/server/ui/controller/proxy.go @@ -30,7 +30,7 @@ func (c *Controller) ImageProxy(ctx *core.Context, request *core.Request, respon return } - decodedURL, err := base64.StdEncoding.DecodeString(encodedURL) + decodedURL, err := base64.URLEncoding.DecodeString(encodedURL) if err != nil { response.HTML().BadRequest(errors.New("Unable to decode this URL")) return diff --git a/server/ui/filter/image_proxy_filter.go b/server/ui/filter/image_proxy_filter.go index 1b200a4..12c9da6 100644 --- a/server/ui/filter/image_proxy_filter.go +++ b/server/ui/filter/image_proxy_filter.go @@ -36,5 +36,6 @@ func ImageProxyFilter(router *mux.Router, data string) string { // Proxify returns a proxified link. func Proxify(router *mux.Router, link string) string { - return route.Path(router, "proxy", "encodedURL", base64.StdEncoding.EncodeToString([]byte(link))) + // We use base64 url encoding to avoid slash in the URL. + return route.Path(router, "proxy", "encodedURL", base64.URLEncoding.EncodeToString([]byte(link))) } |