From 97a8777d037cf666989bc63f592a384c6accf0b5 Mon Sep 17 00:00:00 2001 From: Simon Frei Date: Fri, 12 Mar 2021 21:15:50 +0100 Subject: [PATCH] lib/fs: Check both old and new path when renaming (fixes #7426) (#7463) --- lib/fs/casefs.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/fs/casefs.go b/lib/fs/casefs.go index 368a5e4df..0d9ab2500 100644 --- a/lib/fs/casefs.go +++ b/lib/fs/casefs.go @@ -224,6 +224,13 @@ func (f *caseFilesystem) Rename(oldpath, newpath string) error { if err := f.checkCase(oldpath); err != nil { return err } + if err := f.checkCase(newpath); err != nil { + // Case-only rename is ok + e := &ErrCaseConflict{} + if !errors.As(err, &e) || e.Real != oldpath { + return err + } + } if err := f.Filesystem.Rename(oldpath, newpath); err != nil { return err }