From 8a86356a9eb11bd892ebad24ee3cd58920af5d76 Mon Sep 17 00:00:00 2001 From: Hendrik Leidinger Date: Thu, 19 Feb 2026 14:48:15 -0800 Subject: [PATCH 1/7] fix: exclude Readme.md files from file locking in the text app Signed-off-by: Hendrik Leidinger --- lib/Service/ApiService.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/Service/ApiService.php b/lib/Service/ApiService.php index e50afa81650..20b0de4ad00 100644 --- a/lib/Service/ApiService.php +++ b/lib/Service/ApiService.php @@ -129,7 +129,9 @@ public function create(?int $fileId = null, ?string $filePath = null, ?string $b $hasOwner = $file->getOwner() !== null; - if (!$readOnly) { + // Disable file locking for Readme.md files, because in the + // current setup, this makes it almost impossible to delete these files. + if (!$readOnly && $file->getName() != "Readme.md") { $isLocked = $this->documentService->lock($file->getId()); if (!$isLocked) { $readOnly = true; From 6d9d7fbd569a560c7a58c1af583f94ae237b6b93 Mon Sep 17 00:00:00 2001 From: Hendrik Leidinger Date: Thu, 19 Feb 2026 15:05:04 -0800 Subject: [PATCH 2/7] fix: make the check case insensitive Signed-off-by: Hendrik Leidinger --- lib/Service/ApiService.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Service/ApiService.php b/lib/Service/ApiService.php index 20b0de4ad00..6f596dbd41c 100644 --- a/lib/Service/ApiService.php +++ b/lib/Service/ApiService.php @@ -131,7 +131,7 @@ public function create(?int $fileId = null, ?string $filePath = null, ?string $b // Disable file locking for Readme.md files, because in the // current setup, this makes it almost impossible to delete these files. - if (!$readOnly && $file->getName() != "Readme.md") { + if (!$readOnly && strcasecmp($file->getName(), "Readme.md") !== 0) { $isLocked = $this->documentService->lock($file->getId()); if (!$isLocked) { $readOnly = true; From de24ab745da57d2257e479e83130f374b933f2c1 Mon Sep 17 00:00:00 2001 From: Hendrik Leidinger Date: Thu, 19 Feb 2026 15:10:24 -0800 Subject: [PATCH 3/7] fixed style issues Signed-off-by: Hendrik Leidinger --- lib/Service/ApiService.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Service/ApiService.php b/lib/Service/ApiService.php index 6f596dbd41c..28b14d9afa7 100644 --- a/lib/Service/ApiService.php +++ b/lib/Service/ApiService.php @@ -131,7 +131,7 @@ public function create(?int $fileId = null, ?string $filePath = null, ?string $b // Disable file locking for Readme.md files, because in the // current setup, this makes it almost impossible to delete these files. - if (!$readOnly && strcasecmp($file->getName(), "Readme.md") !== 0) { + if (!$readOnly && strcasecmp($file->getName(), 'Readme.md') !== 0) { $isLocked = $this->documentService->lock($file->getId()); if (!$isLocked) { $readOnly = true; From 84434b9533396a519488a85de1f77d2f63ccdf5a Mon Sep 17 00:00:00 2001 From: Hendrik Leidinger Date: Thu, 19 Feb 2026 16:04:00 -0800 Subject: [PATCH 4/7] fix: check if name is null Signed-off-by: Hendrik Leidinger --- lib/Service/ApiService.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Service/ApiService.php b/lib/Service/ApiService.php index 28b14d9afa7..493058eee27 100644 --- a/lib/Service/ApiService.php +++ b/lib/Service/ApiService.php @@ -131,7 +131,7 @@ public function create(?int $fileId = null, ?string $filePath = null, ?string $b // Disable file locking for Readme.md files, because in the // current setup, this makes it almost impossible to delete these files. - if (!$readOnly && strcasecmp($file->getName(), 'Readme.md') !== 0) { + if (!$readOnly && strcasecmp($file->getName() ?? '', 'Readme.md') !== 0) { $isLocked = $this->documentService->lock($file->getId()); if (!$isLocked) { $readOnly = true; From 3fff0180837310d753b7d8b6fc21deeac8c308aa Mon Sep 17 00:00:00 2001 From: Hendrik Leidinger Date: Thu, 19 Feb 2026 16:16:02 -0800 Subject: [PATCH 5/7] fix: attempt to make psalm happy Signed-off-by: Hendrik Leidinger --- lib/Service/ApiService.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Service/ApiService.php b/lib/Service/ApiService.php index 493058eee27..4f208198d97 100644 --- a/lib/Service/ApiService.php +++ b/lib/Service/ApiService.php @@ -131,7 +131,7 @@ public function create(?int $fileId = null, ?string $filePath = null, ?string $b // Disable file locking for Readme.md files, because in the // current setup, this makes it almost impossible to delete these files. - if (!$readOnly && strcasecmp($file->getName() ?? '', 'Readme.md') !== 0) { + if (!$readOnly && strcasecmp((string) $file->getName(), 'Readme.md') !== 0) { $isLocked = $this->documentService->lock($file->getId()); if (!$isLocked) { $readOnly = true; From e845b5b36d9c3954fad78b77510bca89ddef2467 Mon Sep 17 00:00:00 2001 From: Hendrik Leidinger Date: Thu, 19 Feb 2026 16:19:34 -0800 Subject: [PATCH 6/7] fix: another attempt to make psalm happy Signed-off-by: Hendrik Leidinger --- lib/Service/ApiService.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/Service/ApiService.php b/lib/Service/ApiService.php index 4f208198d97..f1e97eaad13 100644 --- a/lib/Service/ApiService.php +++ b/lib/Service/ApiService.php @@ -131,7 +131,8 @@ public function create(?int $fileId = null, ?string $filePath = null, ?string $b // Disable file locking for Readme.md files, because in the // current setup, this makes it almost impossible to delete these files. - if (!$readOnly && strcasecmp((string) $file->getName(), 'Readme.md') !== 0) { + /** @psalm-suppress RedundantCastGivenDocblockType */ + if (!$readOnly && strcasecmp((string)$file->getName(), 'Readme.md') !== 0) { $isLocked = $this->documentService->lock($file->getId()); if (!$isLocked) { $readOnly = true; From c99bcaee50abe8726edddf828bca5c3f16ebd816 Mon Sep 17 00:00:00 2001 From: Hendrik Leidinger Date: Tue, 3 Mar 2026 23:51:05 -0800 Subject: [PATCH 7/7] removed psalm suppress and cast, fixed tests Signed-off-by: Hendrik Leidinger --- lib/Service/ApiService.php | 3 +-- tests/unit/Service/ApiServiceTest.php | 1 + 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/Service/ApiService.php b/lib/Service/ApiService.php index f1e97eaad13..28b14d9afa7 100644 --- a/lib/Service/ApiService.php +++ b/lib/Service/ApiService.php @@ -131,8 +131,7 @@ public function create(?int $fileId = null, ?string $filePath = null, ?string $b // Disable file locking for Readme.md files, because in the // current setup, this makes it almost impossible to delete these files. - /** @psalm-suppress RedundantCastGivenDocblockType */ - if (!$readOnly && strcasecmp((string)$file->getName(), 'Readme.md') !== 0) { + if (!$readOnly && strcasecmp($file->getName(), 'Readme.md') !== 0) { $isLocked = $this->documentService->lock($file->getId()); if (!$isLocked) { $readOnly = true; diff --git a/tests/unit/Service/ApiServiceTest.php b/tests/unit/Service/ApiServiceTest.php index 49b8d242302..aa5c7754c09 100644 --- a/tests/unit/Service/ApiServiceTest.php +++ b/tests/unit/Service/ApiServiceTest.php @@ -76,6 +76,7 @@ private function mockFile(int $id, ?string $owner) { $file->method('getStorage')->willReturn($storage); $file->method('getId')->willReturn($id); $file->method('getOwner')->willReturn($owner); + $file->method('getName')->willReturn('name'); $file->method('getContent')->willReturn('file content'); return $file; }