When path is a "directory" (prefix) we might end up going into full listing operation to just get an info for a single path. We call ls and we don't pass any limits (and it seems GCSFS doesn't support max results atm?).
out = await self._ls(path, **kwargs) # Here we can go into a long listing since we don't limit it
out0 = [o for o in out if o["name"].rstrip("/") == path]
if out0:
# exact hit
return out0[0]
elif out:
# other stuff - must be a directory
Is it intentional for some reason?
On s3 and Azure, in similar place we list to check if at least a single key exists (we don't check for an exact hit).
Can we drop the exact hit check and pass max results into ls?