Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ApiController::actionSearch() try/catch placement #34

Open
boehmi1988 opened this issue Dec 2, 2022 · 0 comments
Open

ApiController::actionSearch() try/catch placement #34

boehmi1988 opened this issue Dec 2, 2022 · 0 comments

Comments

@boehmi1988
Copy link

In ApiController::actionSearch() the try/catch block is placed around code that will not throw an exception ever - the actual Exception coming from $fileSystem->get() is never catched / ignored.

So the search crashes, if there is a FileflyHashmap record which references a file that does not exists

` foreach ($query->all() as $item) {

        // check read permissions or is folder
        if (!$fileSystem->grantAccess($item['path'],
                Filefly::ACCESS_READ) || $fileSystem->get($item['path'])->isDir()) {
            continue;
        }

        try {
            $item['id'] = $item['path'];
            $item['mime'] = '';
            $result[] = $item;
        } catch (FileNotFoundException $e) {
            \Yii::warning($e->getMessage(), __METHOD__);
            continue;
        }
    }`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant