fix: check if the req path is relative path (close #2531)

This commit is contained in:
Noah Hsu
2022-11-30 21:38:00 +08:00
parent f9788ea7cf
commit b5bf5f4325
8 changed files with 172 additions and 68 deletions

View File

@ -22,7 +22,11 @@ func FsUp(c *gin.Context) {
return
}
user := c.MustGet("user").(*model.User)
path = stdpath.Join(user.BasePath, path)
path, err = user.JoinPath(path)
if err != nil {
common.ErrorResp(c, err, 403)
return
}
meta, err := db.GetNearestMeta(stdpath.Dir(path))
if err != nil {
if !errors.Is(errors.Cause(err), errs.MetaNotFound) {