Skip to content

Commit b3951c1

Browse files
author
Matt Allen
committed
When attempting to move file, it errors if the destination file already exists
1 parent 3b784b5 commit b3951c1

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

lock.go

+3
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ func (f *FileOperation) CanMove(from, to string) error {
3737
if !doesFileExist(from) {
3838
return errors.New("the source file does not exist")
3939
}
40+
if doesFileExist(to) {
41+
return errors.New("file already exists with this name at the destination")
42+
}
4043
if !isValidFolderPath(from) {
4144
return errors.New("the source is not a valid file path")
4245
}

0 commit comments

Comments
 (0)