From 5548ab62ac27cb4ad30e735a1a3f4e46a63d3cbb Mon Sep 17 00:00:00 2001 From: Noah Hsu Date: Mon, 19 Sep 2022 13:35:37 +0800 Subject: [PATCH] fix: write does not take effect on the current dir (close #1711) --- server/handles/fsmanage.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/server/handles/fsmanage.go b/server/handles/fsmanage.go index a3c30e27095..f9b6c298673 100644 --- a/server/handles/fsmanage.go +++ b/server/handles/fsmanage.go @@ -31,7 +31,7 @@ func FsMkdir(c *gin.Context) { user := c.MustGet("user").(*model.User) req.Path = stdpath.Join(user.BasePath, req.Path) if !user.CanWrite() { - meta, err := db.GetNearestMeta(req.Path) + meta, err := db.GetNearestMeta(stdpath.Dir(req.Path)) if err != nil { if !errors.Is(errors.Cause(err), errs.MetaNotFound) { common.ErrorResp(c, err, 500, true) @@ -199,7 +199,7 @@ func FsPut(c *gin.Context) { user := c.MustGet("user").(*model.User) path = stdpath.Join(user.BasePath, path) if !user.CanWrite() { - meta, err := db.GetNearestMeta(path) + meta, err := db.GetNearestMeta(stdpath.Dir(path)) if err != nil { if !errors.Is(errors.Cause(err), errs.MetaNotFound) { common.ErrorResp(c, err, 500, true)