flysystem-google-cloud-storage
flysystem-google-cloud-storage copied to clipboard
Catch notfound exception on deleting non existing file
Issue
Projects using FlySystem can use League\Flysystem\AdapterInterface::deleteDir() to remove a directory from a filesystem. This should return a boolean to indicate whether this succeeded. This GCP implementation does however throw an exception.
This Pull Request fixes the issue.
An example where this happens is in Shopware 6, described here https://github.com/shopware/platform/pull/2108
Reproduction
- Use this project as described in README.md.
- Try to delete a directory from a GCP bucket that does not exist.
- See that instead of false being returned, a Google\Cloud\Core\Exception\NotFoundException is being thrown
- See that this can be an issue for downstream software relying on this repository.
The fix
The fix is quite easy actually: catch the exception thrown by the Google Cloud PHP API, so this implementation of the AdapterInterface matches the expected behaviour.
@matthewgoslett can you have a look at this please? :+1:
@matthewgoslett poke ;)
@matthewgoslett poke :)
@matthewgoslett poke :)
Hey. Sorry, I haven't been at the organisation Superbalist for quite a few years now and am no longer involved in this project.
On Wed, 11 Jan 2023 at 22:33, Stefan van Essen @.***> wrote:
@matthewgoslett https://github.com/matthewgoslett poke :)
— Reply to this email directly, view it on GitHub https://github.com/Superbalist/flysystem-google-cloud-storage/pull/122#issuecomment-1379511861, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAL7XH5IGGUU3K4BHEIIPPDWR4RJXANCNFSM5FOVT4IQ . You are receiving this because you were mentioned.Message ID: @.*** com>
Hi @matthewgoslett thanks for letting me know, is there anyone else I could reach out to?
@shad0wfir3 It seems you are the last person to have merged something, can I ask you to look at this PR? I'm not quite sure how to mention @superbalist/core from the CODEOWNERS file, but saw your name.
@shad0wfir3 poke :)
@shad0wfir3 poke :)