flysystem-google-cloud-storage icon indicating copy to clipboard operation
flysystem-google-cloud-storage copied to clipboard

Catch notfound exception on deleting non existing file

Open eXistenZNL opened this issue 3 years ago • 10 comments

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.

eXistenZNL avatar Oct 06 '21 14:10 eXistenZNL

@matthewgoslett can you have a look at this please? :+1:

eXistenZNL avatar Nov 01 '21 16:11 eXistenZNL

@matthewgoslett poke ;)

eXistenZNL avatar Nov 09 '21 11:11 eXistenZNL

@matthewgoslett poke :)

eXistenZNL avatar Oct 26 '22 14:10 eXistenZNL

@matthewgoslett poke :)

eXistenZNL avatar Jan 11 '23 21:01 eXistenZNL

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>

matthewgoslett avatar Jan 16 '23 13:01 matthewgoslett

Hi @matthewgoslett thanks for letting me know, is there anyone else I could reach out to?

eXistenZNL avatar Jan 16 '23 21:01 eXistenZNL

@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.

eXistenZNL avatar Jan 19 '23 10:01 eXistenZNL

@shad0wfir3 poke :)

eXistenZNL avatar Feb 15 '23 14:02 eXistenZNL

@shad0wfir3 poke :)

eXistenZNL avatar May 23 '23 13:05 eXistenZNL