Skip to content

Commit

Permalink
Merge pull request #6461 from nextcloud/backport/5959/stable29
Browse files Browse the repository at this point in the history
[stable29] perf: optimize WorkspaceService::getFile
  • Loading branch information
mejo- authored Sep 26, 2024
2 parents 95ec72d + 56ff2a7 commit 0a0d812
Showing 1 changed file with 6 additions and 8 deletions.
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

0 comments on commit 0a0d812

Please sign in to comment.