Closed aperiodic closed 1 year ago
interesting We have a test that check it and pass I see know that if I add only nested folder it works :man_facepalming: OK checking ...
Yeah, before I opened this issue I took a look at the tests and observed that glob
test only calls .glob()
on a top-level directory S3Path instance, and the rest of the calls are on instances corresponding to the bucket itself, so the test doesn't cover this case.
Version 0.4.1 deployed with a fix and another test to check this scenario
Thank you! We've confirmed that 0.4.1 fixes this issue for us. I'll mark this issue as resolved.
It appears that the new glob algorithm in S3Path 0.4.0 doesn't work if the directory on which
.glob()
is being called is nested within a bucket, rather than being at the top level of a bucket. Depending on how much nesting is involved, either an error is raised, or the glob incorrectly returns no results.Steps to Reproduce
nested_dir = s3path.S3Path("/my-bucket/s3path-test/nested")
If you repeat the reproduction steps using another level of nesting, e.g. after creating the S3 file
s3://my-bucket/s3path-test/nested/further/test.txt
, then instead of a stack trace being raised, the iterator is incorrectly empty:Workaround
This can be avoided by configuring s3path to use the old glob algorithm, before creating any
S3Path
instances. If I import s3path, call:and then follow the reproduction steps above, I get the correct result. This makes me confident that the problem is entirely specific to the new globbing algorithm.
I hope this is useful! Please let me know if you'd like any more information from me about this.
Finally, thank you for creating & maintaining S3Path! It's been very nice for me and my team at work, by allowing us to write code that deals only with the Path abstraction, and be able to use that code both for local paths or S3 ones.