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 committed Jun 27, 2024
commit 5020d9b05ab1aee214503935b9b8b4d4c5ef3522
14 changes: 6 additions & 8 deletions lib/Service/WorkspaceService.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,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