fix: check password while upload (close #2444)

This commit is contained in:
Noah Hsu
2022-11-22 16:14:01 +08:00
parent c09800790b
commit 85e1350af8
6 changed files with 81 additions and 63 deletions

View File

@ -35,7 +35,7 @@ func FsMkdir(c *gin.Context) {
return
}
}
if !canWrite(meta, req.Path) {
if !common.CanWrite(meta, req.Path) {
common.ErrorResp(c, errs.PermissionDenied, 403)
return
}
@ -48,13 +48,6 @@ func FsMkdir(c *gin.Context) {
common.SuccessResp(c)
}
func canWrite(meta *model.Meta, path string) bool {
if meta == nil || !meta.Write {
return false
}
return meta.WSub || meta.Path == path
}
type MoveCopyReq struct {
SrcDir string `json:"src_dir"`
DstDir string `json:"dst_dir"`