spatie / flysystem-dropbox

A flysystem driver for Dropbox that uses the v2 API
https://freek.dev/734-dropbox-will-turn-off-v1-of-their-api-soon-its-time-to-update-your-php-application
MIT License
342 stars 50 forks source link

Make listing a non-created directory not throw an exception. #72

Closed BusterNeece closed 3 years ago

BusterNeece commented 3 years ago

For other adapters, if you list a directory that wasn't already created, the listContents call will simply return nothing; currently the Dropbox adapter throws a "not found" exception in this case, which (even though it makes sense in this context) makes its behavior at odds with the other adapters.

This PR just catches that exception and halts the generator early instead.

freekmurze commented 3 years ago

I'm not 100% sure that we should do this. If I'm not mistaken that Flysytem v2 now favours throwing exception instead of silently erroring.

What's your opinion about this @frankdejonge?

frankdejonge commented 3 years ago

@freekmurze for non-existent directories the listing should be empty, no exception needed. We model this after cloud filesystems where directories do not necessarily exist. It's basically a filter by prefix operation on all the entries of a filesystem.

TL;RD: looks good 👍

freekmurze commented 3 years ago

@SlvrEagle23 @frankdejonge Thanks!