Skip to content

Commit

Permalink
Implemented filtering of "ghost" objects in _ls
Browse files Browse the repository at this point in the history
  • Loading branch information
VOvchinnikov committed May 23, 2024
1 parent d371e21 commit 989419b
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions gcsfs/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 989419b

Please sign in to comment.