Skip to content

Commit

Permalink
If listing expires between checking it, and using it (#655)
Browse files Browse the repository at this point in the history
  • Loading branch information
martindurant committed Sep 30, 2022
1 parent 227a905 commit 1c1ab4e
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions s3fs/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -1158,12 +1158,13 @@ async def _info(self, path, bucket=None, key=None, refresh=False, version_id=Non
if path in ["/", ""]:
return {"name": path, "size": 0, "type": "directory"}
version_id = _coalesce_version_id(path_version_id, version_id)
if not refresh and self._ls_from_cache(path) is not None:
if not refresh:
out = self._ls_from_cache(path)
out = [o for o in out if o["name"] == path]
if out:
return out[0]
return {"name": path, "size": 0, "type": "directory"}
if out is not None:
out = [o for o in out if o["name"] == path]
if out:
return out[0]
return {"name": path, "size": 0, "type": "directory"}
if key:
try:
out = await self._call_s3(
Expand Down

0 comments on commit 1c1ab4e

Please sign in to comment.