mirror of
https://github.com/drakkan/sftpgo.git
synced 2025-12-07 14:50:55 +03:00
allow cross folder renaming if the underlying resource is the same
this was only allowed for the local filesystem before this change Signed-off-by: Nicola Murino <nicola.murino@gmail.com>
This commit is contained in:
@@ -116,6 +116,9 @@ func (*OsFs) Create(name string, flag int) (File, *PipeWriter, func(), error) {
|
||||
|
||||
// Rename renames (moves) source to target
|
||||
func (fs *OsFs) Rename(source, target string) error {
|
||||
if source == target {
|
||||
return nil
|
||||
}
|
||||
err := os.Rename(source, target)
|
||||
if err != nil && isCrossDeviceError(err) {
|
||||
fsLog(fs, logger.LevelError, "cross device error detected while renaming %#v -> %#v. Trying a copy and remove, this could take a long time",
|
||||
|
||||
Reference in New Issue
Block a user