Skip to content

Commit

Permalink
Fix the cache lookup in _info (#840)
Browse files Browse the repository at this point in the history
  • Loading branch information
YeahItsMeAgain authored Dec 16, 2023
1 parent 0216856 commit 34a3219
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion s3fs/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -1293,7 +1293,7 @@ async def _info(self, path, bucket=None, key=None, refresh=False, version_id=Non
if out:
return out[0]
else:
out = [o for o in out if o["name"] == path]
out = [o for o in out if o["name"] == fullpath]
if out:
return out[0]
return {"name": path, "size": 0, "type": "directory"}
Expand Down
1 change: 1 addition & 0 deletions s3fs/tests/test_s3fs.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,7 @@ def test_info(s3):
s3.ls(parent) # fill the cache with parent dir
assert s3.info(a) == s3.dircache[parent][0] # correct value
assert id(s3.info(a)) == id(s3.dircache[parent][0]) # is object from cache
assert id(s3.info(f"/{a}")) == id(s3.dircache[parent][0]) # is object from cache

new_parent = test_bucket_name + "/foo"
s3.mkdir(new_parent)
Expand Down

0 comments on commit 34a3219

Please sign in to comment.