chore: decode filePath in header

pull/1604/head
Noah Hsu 2022-08-28 20:46:33 +08:00
parent e72a557b96
commit e5480b99be
1 changed files with 6 additions and 0 deletions

View File

@ -2,6 +2,7 @@ package handles
import (
"fmt"
"net/url"
stdpath "path"
"strconv"
"time"
@ -189,6 +190,11 @@ func FsRemove(c *gin.Context) {
func FsPut(c *gin.Context) {
path := c.GetHeader("File-Path")
path, err := url.PathUnescape(path)
if err != nil {
common.ErrorResp(c, err, 400)
return
}
asTask := c.GetHeader("As-Task") == "true"
user := c.MustGet("user").(*model.User)
path = stdpath.Join(user.BasePath, path)