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>
This commit is contained in:
Guang Jiong Lou
2024-10-22 23:46:18 +08:00
committed by GitHub
parent 970059d4ce
commit 9369a88c5c
2 changed files with 19 additions and 3 deletions

View File

@@ -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)