Skip to content

LLM-Driven Extraction of Unstructured Data — Built for API Deployments & ETL Pipeline Workflows

UN-3578 [FIX] GDrive folder browser no longer breaks on Google Docs (#2093)

Kirtiman Mishrade49f0681f62
diff --git a/backend/file_management/file_management_helper.py b/backend/file_management/file_management_helper.py
index ab56c4dba..008368d09 100644
--- a/backend/file_management/file_management_helper.py
+++ b/backend/file_management/file_management_helper.py
@@ -81,9 +81,18 @@ class FileManagerHelper:
if os.path.normpath(file_path) == os.path.normpath(file_name):
continue
- # Call fs.info() to get file size if its missing
+ # Google-native docs (Docs/Sheets/Slides) carry no fileSize, so pydrive2's
+ # info() raises on int(None); fall back to 0 (display-only) to keep listing.
if file_info.get("type") == "file" and file_info.get("size") is None:
- file_info = fs.info(file_name)
+ try:
+ file_info = fs.info(file_name)
+ except Exception as exc:
+ logger.warning(
+ "fs.info() failed for %s; using ls() metadata: %s",
+ file_name,
+ exc,
+ )
+ file_info["size"] = 0
file_content_type = file_info.get("ContentType")
if not file_content_type:
diff --git a/frontend/src/components/input-output/file-system/FileSystem.jsx b/frontend/src/components/input-output/file-system/FileSystem.jsx
index 2ce90ef48..3380abcde 100644
--- a/frontend/src/components/input-output/file-system/FileSystem.jsx
+++ b/frontend/src/components/input-output/file-system/FileSystem.jsx
@@ -204,7 +204,8 @@ function transformTree(tree) {
title = key.split("/").at(-1);
isFile = node.type === "file";
modifiedDate = node.modified_at?.split(" ")[0] || "";
- size = isFile ? formatBytes(node.size) : "";
+ // Blank when size is 0/unknown (e.g. Google-native docs) instead of "0 B".
+ size = isFile && node.size ? formatBytes(node.size) : "";
node["key"] = key;
node["icon"] = isFile ? <Document /> : <Folder />;