-
Notifications
You must be signed in to change notification settings - Fork 43
exists()
returns True when bucket versioning is enabled and object was deleted
#194
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
Comments
Looking into this more, it seems like this function is returning def _is_versioned_path(path):
return hasattr(path, "version_id") and bool(path.version_id) because the |
@dbragdonmw for buckets with versioning enabled we have to use the VersionedS3Path class instead of the regular S3Path Is the VersionedS3Path class solve your issue? You can also see the doc's here |
Hi @liormizr thanks for getting back to me. We were initially using Our workflow currently looks something like this: path = S3Path("s3://some-bucket/path/to/some/key")
if path.exists(): # currently returns True if the object is versioned but currently has a delete marker
with path.open('r') as fp: # code crashes here because file doesn't actually exist in a readable state
data = fp.read() If we were to use path = VersionedS3Path("s3://some-bucket/path/to/some/key", version_id="?")
... As far as checking if a versioned object currently "exists", we don't particularly care about any specific versions as long as the current version has a delete marker attached to it, so If this is not in line with the philosophy of how to use |
Hi @dbragdonmw |
Uh oh!
There was an error while loading. Please reload this page.
It appears that if a bucket has object versioning enabled, calling
exists()
on anS3Path
object of a deleted path will returnTrue
, is this expected behavior?For reference, I am using python version 3.12.9 and s3path 0.6.1
The text was updated successfully, but these errors were encountered: