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

Checking for object existence #373

Open
Palladinium opened this issue Dec 24, 2023 · 1 comment
Open

Checking for object existence #373

Palladinium opened this issue Dec 24, 2023 · 1 comment
Assignees

Comments

@Palladinium
Copy link

Is your feature request related to a problem? Please describe.
There is currently no way to check whether an object exists in a bucket.
The README has a link to an exists function, but the method doesn't actually exist:

| `exists` | [async](https://docs.rs/rust-s3/latest/s3/bucket/struct.Bucket.html#method.exists)|

Describe the solution you'd like
Adding an exists method to the Bucket API.

Describe alternatives you've considered
I've tried using get_object or head_object and checking for the error variant, but I have no idea which S3Error variant is returned when the object doesn't exist vs when anything else goes wrong with fetching the object's data.

@Palladinium
Copy link
Author

It looks like the error value returned when an object doesn't exist is S3Error::Http(404, _).
It'd still be nice to get this as its own feature.
Note that without the ListBucket permission, you will always get a 403 instead, and you tell whether an object doesn't exist or you just can't access it - this is by design in S3's API.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants