chore: add refresh arg in list func

This commit is contained in:
Noah Hsu
2022-08-29 19:15:52 +08:00
parent 97d4114e38
commit 68a125491b
4 changed files with 11 additions and 5 deletions

View File

@ -22,6 +22,7 @@ type ListReq struct {
common.PageReq
Path string `json:"path" form:"path"`
Password string `json:"password" form:"password"`
Refresh bool `json:"refresh"`
}
type DirReq struct {
@ -67,7 +68,11 @@ func FsList(c *gin.Context) {
common.ErrorStrResp(c, "password is incorrect", 403)
return
}
objs, err := fs.List(c, req.Path)
if !user.CanWrite() && !canWrite(meta, req.Path) && req.Refresh {
common.ErrorStrResp(c, "Refresh without permission", 403)
return
}
objs, err := fs.List(c, req.Path, req.Refresh)
if err != nil {
common.ErrorResp(c, err, 500)
return