From 5473bbff8682c71f676b19aed1170967beeb0fc6 Mon Sep 17 00:00:00 2001 From: Andreas Hennings Date: Thu, 9 Jan 2025 00:42:55 +0100 Subject: [PATCH] Issue 83: Inline $old_file_uri. --- src/Controller/WopiController.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Controller/WopiController.php b/src/Controller/WopiController.php index 14f54014..b58feaf9 100644 --- a/src/Controller/WopiController.php +++ b/src/Controller/WopiController.php @@ -182,11 +182,12 @@ public function wopiPutFile(MediaInterface $media, FileInterface $file, UserInte * This may have a different uri, but will have the same filename. */ protected function createNewFileEntity(FileInterface $file, string $new_file_content): FileInterface { - $old_file_uri = $file->getFileUri(); - + // Attempt to reuse the old file uri for the new file. + // This will trigger a rename with number suffix, because the old file still + // exists in the filesystem. $new_file_uri = $this->fileSystem->saveData( $new_file_content, - $old_file_uri, + $file->getFileUri(), FileExists::Rename, );