UN-3578 [FIX] GDrive folder browser no longer breaks on Google Docs#2093
UN-3578 [FIX] GDrive folder browser no longer breaks on Google Docs#2093kirtimanmishrazipstack merged 5 commits intomainZipstack/unstract:mainfrom UN-3578-gdrive-authentication-wf-pipelineZipstack/unstract:UN-3578-gdrive-authentication-wf-pipelineCopy head branch name to clipboard
Conversation
…ile lacks a size Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Summary by CodeRabbit
WalkthroughWhen listing files returns entries with missing size data, the backend now wraps the ChangesUnknown File Size Resilience
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
| Filename | Overview |
|---|---|
| backend/file_management/file_management_helper.py | Wraps fs.info() in try/except for Google-native files that have no fileSize; falls back to size=0 and logs a warning with the bound exception. Change is surgical and scoped to the folder-browser listing path only. |
| frontend/src/components/input-output/file-system/FileSystem.jsx | Adds a truthiness guard on node.size before calling formatBytes, so Google-native docs with size=0 display a blank cell rather than "0 B". Minor side-effect: genuine zero-byte files will also show blank. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[fs.ls path detail=true] --> B{for each file_info}
B --> C{type==file AND size is None?}
C -- No --> G[Use ls metadata as-is]
C -- Yes --> D[fs.info file_name]
D -- success --> E[Use enriched file_info]
D -- Exception --> F["Log warning with exc\nSet size = 0"]
E --> H[FileInformation]
F --> H
G --> H
H --> I[Return file_list]
subgraph Frontend
I --> J[transformTree]
J --> K{isFile AND node.size truthy?}
K -- Yes --> L[formatBytes node.size]
K -- No --> M[size = blank]
end
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
flowchart TD
A[fs.ls path detail=true] --> B{for each file_info}
B --> C{type==file AND size is None?}
C -- No --> G[Use ls metadata as-is]
C -- Yes --> D[fs.info file_name]
D -- success --> E[Use enriched file_info]
D -- Exception --> F["Log warning with exc\nSet size = 0"]
E --> H[FileInformation]
F --> H
G --> H
H --> I[Return file_list]
subgraph Frontend
I --> J[transformTree]
J --> K{isFile AND node.size truthy?}
K -- Yes --> L[formatBytes node.size]
K -- No --> M[size = blank]
end
Reviews (5): Last reviewed commit: "UN-3578 [FIX] Show blank instead of 0 B ..." | Re-trigger Greptile
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@backend/file_management/file_management_helper.py`:
- Around line 89-92: The except block is catching too broad an Exception type
without logging the actual error, which can hide unexpected bugs. Replace the
generic Exception catch with more specific exception types related to fsspec or
connector operations (such as FileNotFoundError, PermissionError, or other
fsspec-specific exceptions), and modify the logger.warning call to include the
actual exception object as part of the log message so that the root cause is
captured while still applying the fallback metadata behavior for known issues.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: c35df02b-54f9-4f14-bb99-b2efbfe381e1
📒 Files selected for processing (1)
backend/file_management/file_management_helper.py
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
chandrasekharan-zipstack
left a comment
There was a problem hiding this comment.
I would still recommend leaving that size field blank rather than displaying 0 B. You can't distinguish between a failed file and one that is actually 0 B
…sting Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…ector browser Google-native docs report no size; the folder browser now leaves the size field blank rather than asserting a misleading 0 B. Display-only; applies uniformly across all file connectors. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Frontend Lint Report (Biome)✅ All checks passed! No linting or formatting issues found. |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
frontend/src/components/input-output/file-system/FileSystem.jsx (1)
207-208: 🏗️ Heavy liftDistinguish unknown size from real
0 Bto avoid masking zero-byte files.Using a truthy check (
node.size) makes real zero-byte files render as blank, same as unknown sizes. Consider using an explicit unknown sentinel (null/undefined) from the backend and checkingnode.size == nullhere, so actual0still displays as0 B.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@frontend/src/components/input-output/file-system/FileSystem.jsx` around lines 207 - 208, The current truthy check for node.size in the size variable assignment treats both zero-byte files (actual 0 value) and unknown sizes (null/undefined from backend) identically, displaying both as blank. Fix this by replacing the truthy check `node.size ?` with an explicit null/undefined check using `node.size == null` (or `node.size != null` in the ternary), so that actual zero values will be formatted as "0 B" while truly unknown sizes remain blank.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@frontend/src/components/input-output/file-system/FileSystem.jsx`:
- Around line 207-208: The current truthy check for node.size in the size
variable assignment treats both zero-byte files (actual 0 value) and unknown
sizes (null/undefined from backend) identically, displaying both as blank. Fix
this by replacing the truthy check `node.size ?` with an explicit null/undefined
check using `node.size == null` (or `node.size != null` in the ternary), so that
actual zero values will be formatted as "0 B" while truly unknown sizes remain
blank.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 9795d48f-3ca0-4903-b0b3-56efa2f011fd
📒 Files selected for processing (1)
frontend/src/components/input-output/file-system/FileSystem.jsx
Unstract test resultsPer-group results
Critical paths
|
@chandrasekharan-zipstack Agreed, fixed — size now shows blank instead of 0 B for any 0/unknown value (6b32b5f), so we never assert a size we can't determine. One line in the shared browser, applies to all connectors |
|
What
Why
How
get_files()(backend/file_management/file_management_helper.py) wraps the per-filefs.info()size backfill in try/except. pydrive2'sinfo()runs an unguardedint(fileSize)→int(None)for Google-native files (nofileSize), which aborted the entire listing; on failure we now log a warning and keep thels()entry with size 0.Can this PR break any existing features. If yes, please list possible items. If no, please explain why. (PS: Admins do not merge the PR without this section filled)
walk()/ls()).Database Migrations
Env Config
Relevant Docs
Related Issues or PRs
Dependencies Versions
Notes on Testing
Screenshots
Checklist
I have read and understood the Contribution Guidelines.