aboutsummaryrefslogtreecommitdiff
path: root/weed/server
diff options
context:
space:
mode:
authorGuang Jiong Lou <7991675+27149chen@users.noreply.github.com>2024-10-22 23:46:18 +0800
committerGitHub <noreply@github.com>2024-10-22 08:46:18 -0700
commit9369a88c5c659753aeced2c6aa62d0264632c2ea (patch)
treed3bf81cfd07931153284566003ae8f5f7eb2a36a /weed/server
parent970059d4ce07f439a48429bee677881f097ac7b9 (diff)
downloadseaweedfs-9369a88c5c659753aeced2c6aa62d0264632c2ea.tar.xz
seaweedfs-9369a88c5c659753aeced2c6aa62d0264632c2ea.zip
stop renaming worm files (#6154)
* stop renaming worm file Signed-off-by: lou <alex1988@outlook.com> * update after review Signed-off-by: lou <alex1988@outlook.com> * Update weed/server/filer_server_handlers_write.go --------- Signed-off-by: lou <alex1988@outlook.com> Co-authored-by: Chris Lu <chrislusf@users.noreply.github.com>
Diffstat (limited to 'weed/server')
-rw-r--r--weed/server/filer_server_handlers_write.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/weed/server/filer_server_handlers_write.go b/weed/server/filer_server_handlers_write.go
index e745f04f2..75fd5984e 100644
--- a/weed/server/filer_server_handlers_write.go
+++ b/weed/server/filer_server_handlers_write.go
@@ -160,6 +160,14 @@ func (fs *FilerServer) move(ctx context.Context, w http.ResponseWriter, r *http.
return
}
+ rule := fs.filer.FilerConf.MatchStorageRule(src)
+ if rule.Worm {
+ // you cannot move a worm file or directory
+ err = fmt.Errorf("cannot move write-once entry from '%s' to '%s': operation not permitted", src, dst)
+ writeJsonError(w, r, http.StatusForbidden, err)
+ return
+ }
+
oldDir, oldName := srcPath.DirAndName()
newDir, newName := dstPath.DirAndName()
newName = util.Nvl(newName, oldName)