Skip to content

Commit

Permalink
feat: encode path of url (close #1351)
Browse files Browse the repository at this point in the history
  • Loading branch information
xhofe committed Aug 12, 2022
1 parent 0f853c8 commit 06e15fc
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion server/handles/down.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion server/handles/fsmanage.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion server/handles/fsread.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion server/webdav/webdav.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 06e15fc

Please sign in to comment.