diff --git a/lib/Service/ApiService.php b/lib/Service/ApiService.php index e50afa81650..28b14d9afa7 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 && 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; }