From 7827d03c6e9b4dfb34163157a81e597c0a98d402 Mon Sep 17 00:00:00 2001 From: Martin Karlsch Date: Mon, 30 Nov 2020 20:02:38 +0100 Subject: [PATCH] try to detect pseudo folder in _info --- gcsfs/core.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gcsfs/core.py b/gcsfs/core.py index 9cdac125..c029814c 100644 --- a/gcsfs/core.py +++ b/gcsfs/core.py @@ -997,10 +997,10 @@ async def _info(self, path, generation=None, **kwargs): pass kwargs["detail"] = True # Force to true for info out = await self._ls(path, **kwargs) - out0 = [o for o in out if o["name"].rstrip("/") == path] - if out0: + out0 = next((o for o in out if o["name"].rstrip("/") == path), None) + if out0 and out0["name"][-1] != "/" and out0["size"] == 0: # exact hit - return out0[0] + return out0 elif out: # other stuff - must be a directory return {