From 11ec635fd4cd95f0374587d1f04a87ddee060ef7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julius=20H=C3=A4rtl?= Date: Tue, 19 May 2020 20:05:05 +0200 Subject: Return early when iterating over supported filenames MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This fixes multiple files showing up on case-insensitive filenames as otherwise the IFolder::get call creates multiple entries in the filecache for the same file Signed-off-by: Julius Härtl --- lib/Service/WorkspaceService.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/lib/Service/WorkspaceService.php b/lib/Service/WorkspaceService.php index 143d02631..ae5d57f60 100644 --- a/lib/Service/WorkspaceService.php +++ b/lib/Service/WorkspaceService.php @@ -24,17 +24,15 @@ class WorkspaceService { } public function getFile(Folder $folder) { - $file = null; foreach ($this->getSupportedFilenames() as $filename) { if ($folder->nodeExists($filename)) { try { - $file = $folder->get($filename); + return $folder->get($filename); } catch (NotFoundException $e) { } - continue; } } - return $file; + return null; } public function getSupportedFilenames() { -- cgit v1.2.3