fix: Files.exist() will now always return false for buckets that don't exist. #863
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
@sydney-munro Here's a potential solution to #859 which makes sense to me. The implementation could probably be improved since this adds an extra request in many cases.
It might also make more sense to replace the NoSuchFileException here with a more specific IOException like BucketDoesNotExistException which will be handled appropriately by calling code that understands IOException. Adding a new runtime exception here (like FileSystemNotFoundException) would cause issues since Files.exists() and potentially other methods have special handling for the IOExceptions.
Previously Files.exist() would either crash with a StorageException or return true when
checking a path that to a bucket that doesn't exist. This is technically a breaking change
since previously all paths that ended in / were considered to exist when usePseudoDirectories
was set.
Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly:
Fixes #859 ☕️