From 95695120f90735d70c51b700b3d46c479a5b420b 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 7d6a21a4f53dca76fe4a5754b8196e3c5b082c92 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 ad9b7dda0bd85d863a59f22f1cd2e53cd144e8ab 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 51f9b12bddad65bc15776612f01efa77fa58b072 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 c01245bb33b3070ea704a3de184c368454ffe227 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 94b2a61769e534cffe340c3a17dfde8eb7a2d913 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 426acc1c7fc0cae34ae2c4856cb50ecaf1581ff6 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; }