Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
perf: optimize WorkspaceService::getFile
Signed-off-by: Robin Appelman <[email protected]>
  • Loading branch information
icewind1991 authored and mejo- committed Sep 26, 2024
commit 56ff2a79f7bb7ff37b0db4beaa87ca690397d3d8
14 changes: 6 additions & 8 deletions lib/Service/WorkspaceService.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,13 @@ public function __construct(IL10N $l10n) {

public function getFile(Folder $folder): ?File {
foreach ($this->getSupportedFilenames() as $filename) {
if ($folder->nodeExists($filename)) {
try {
$file = $folder->get($filename);
if ($file instanceof File) {
return $file;
}
} catch (NotFoundException|StorageInvalidException) {
return null;
try {
$file = $folder->get($filename);
if ($file instanceof File) {
return $file;
}
} catch (NotFoundException|StorageInvalidException) {
continue;
}
}
return null;
Expand Down