From 989419b44cf75dbf3c3a1454d40a8c1f199d1e88 Mon Sep 17 00:00:00 2001 From: VOvchinnikov Date: Thu, 23 May 2024 13:11:20 +0200 Subject: [PATCH] Implemented filtering of "ghost" objects in `_ls` --- gcsfs/core.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/gcsfs/core.py b/gcsfs/core.py index e6a11331..49e4f462 100644 --- a/gcsfs/core.py +++ b/gcsfs/core.py @@ -1001,6 +1001,15 @@ async def _ls( if versions and "generation" in entry: entry = entry.copy() entry["name"] = f"{entry['name']}#{entry['generation']}" + + if ( + entry["name"].rstrip("/") == path and + entry.get("kind", "") == "storage#object" and + (entry.get("size", "") == "0" or entry.get("size", "") == 0) and + entry.get("crc32c", "") == "AAAAAA==" + ): + # this is the "ghost" object of an empty folder, skip it + continue out.append(entry) if detail: