feat: encode path of url (close #1351)

pull/1604/head
Noah Hsu 2022-08-12 14:51:23 +08:00
parent 0f853c86da
commit 06e15fc149
4 changed files with 4 additions and 4 deletions

View File

@ -55,7 +55,7 @@ func Proxy(c *gin.Context) {
if ok {
URL := fmt.Sprintf("%s%s?sign=%s",
strings.Split(downProxyUrl, "\n")[0],
utils.EncodePath(rawPath),
utils.EncodePath(rawPath, true),
sign.Sign(filename))
c.Redirect(302, URL)
return

View File

@ -248,7 +248,7 @@ func Link(c *gin.Context) {
common.SuccessResp(c, model.Link{
URL: fmt.Sprintf("%s/p%s?d&sign=%s",
common.GetApiUrl(c.Request),
utils.EncodePath(req.Path),
utils.EncodePath(req.Path, true),
sign.Sign(stdpath.Base(rawPath))),
})
return

View File

@ -250,7 +250,7 @@ func FsGet(c *gin.Context) {
} else {
rawURL = fmt.Sprintf("%s/p%s?sign=%s",
common.GetApiUrl(c.Request),
utils.EncodePath(req.Path),
utils.EncodePath(req.Path, true),
sign.Sign(obj.GetName()))
}
} else {

View File

@ -230,7 +230,7 @@ func (h *Handler) handleGetHeadPost(w http.ResponseWriter, r *http.Request) (sta
} else if storage.Config().MustProxy() || storage.GetStorage().WebdavProxy() {
u := fmt.Sprintf("%s/p%s?sign=%s",
common.GetApiUrl(r),
utils.EncodePath(reqPath),
utils.EncodePath(reqPath, true),
sign.Sign(path.Base(reqPath)))
http.Redirect(w, r, u, 302)
} else {