Skip to content

Commit 34a3219

Browse files
Fix the cache lookup in _info (#840)
1 parent 0216856 commit 34a3219

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

s3fs/core.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1293,7 +1293,7 @@ async def _info(self, path, bucket=None, key=None, refresh=False, version_id=Non
12931293
if out:
12941294
return out[0]
12951295
else:
1296-
out = [o for o in out if o["name"] == path]
1296+
out = [o for o in out if o["name"] == fullpath]
12971297
if out:
12981298
return out[0]
12991299
return {"name": path, "size": 0, "type": "directory"}

s3fs/tests/test_s3fs.py

+1
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,7 @@ def test_info(s3):
271271
s3.ls(parent) # fill the cache with parent dir
272272
assert s3.info(a) == s3.dircache[parent][0] # correct value
273273
assert id(s3.info(a)) == id(s3.dircache[parent][0]) # is object from cache
274+
assert id(s3.info(f"/{a}")) == id(s3.dircache[parent][0]) # is object from cache
274275

275276
new_parent = test_bucket_name + "/foo"
276277
s3.mkdir(new_parent)

0 commit comments

Comments
 (0)