Fix file copy operation to handle identical source and destination paths

This commit is contained in:
crazywhalecc
2026-03-20 18:03:58 +08:00
parent 0c389d9069
commit 464ddeb29d

View File

@@ -142,6 +142,9 @@ class FileSystem
logger()->debug("Copying file from {$from} to {$to}");
$dst_path = FileSystem::convertPath($to);
$src_path = FileSystem::convertPath($from);
if ($src_path === $dst_path) {
return true;
}
if (!copy($src_path, $dst_path)) {
throw new FileSystemException('Cannot copy file from ' . $src_path . ' to ' . $dst_path);
}