Skip to content

Commit 827c77d

Browse files
committed
fix: add support to move files onto existing paths for PhpseclibV3
1 parent 91b6fd0 commit 827c77d

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/PhpseclibV3/SftpAdapter.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,14 @@ public function move(string $source, string $destination, Config $config): void
323323
throw UnableToMoveFile::fromLocationTo($source, $destination, $exception);
324324
}
325325

326+
if ($sourceLocation === $destinationLocation) {
327+
return;
328+
}
329+
330+
if ($this->fileExists($destination)) {
331+
$this->delete($destination);
332+
}
333+
326334
if ( ! $connection->rename($sourceLocation, $destinationLocation)) {
327335
throw UnableToMoveFile::fromLocationTo($source, $destination);
328336
}

0 commit comments

Comments
 (0)