Skip to content

fix(google-drive): add auto export format and validate against Drive API docs#4161

Merged
waleedlatif1 merged 7 commits intostagingfrom
waleedlatif1/azure-storage-debug
Apr 14, 2026
Merged

fix(google-drive): add auto export format and validate against Drive API docs#4161
waleedlatif1 merged 7 commits intostagingfrom
waleedlatif1/azure-storage-debug

Conversation

@waleedlatif1
Copy link
Copy Markdown
Collaborator

@waleedlatif1 waleedlatif1 commented Apr 14, 2026

Summary

  • Add "Auto" default option to Google Drive download export format dropdown — picks the best format for the file type automatically (e.g. CSV for Sheets, plain text for Docs)
  • Sanitize auto value in block params so it can't leak to create_file/upload operations
  • Add VALID_EXPORT_FORMATS map based on Google Drive API docs to validate requested formats before calling the API
  • Return clear error with supported formats list when an incompatible format is requested
  • Fix DEFAULT_EXPORT_FORMATS for Forms (application/zip not application/pdf) and Apps Script (application/vnd.google-apps.script+json not application/json)

Type of Change

  • Bug fix
  • Improvement

Testing

Tested manually

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@vercel
Copy link
Copy Markdown

vercel bot commented Apr 14, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Skipped Skipped Apr 14, 2026 10:09pm

Request Review

@cursor
Copy link
Copy Markdown

cursor bot commented Apr 14, 2026

PR Summary

Medium Risk
Moderate risk: changes download/export behavior by defaulting to an auto export mode and rejecting unsupported export MIME types with new 400 responses, which could affect existing workflows relying on permissive behavior.

Overview
Google Drive download now supports an auto export format that maps Google Workspace files to a per-type default export MIME type, and the block UI defaults the Export Format dropdown to auto.

The download API now validates requested export formats against a new VALID_EXPORT_FORMATS allowlist (derived from Drive docs) and returns a clear 400 error listing supported formats when incompatible formats are requested; it also corrects default export formats for Forms and Apps Script.

Reviewed by Cursor Bugbot for commit 291b2ee. Configure here.

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Apr 14, 2026

Greptile Summary

Fixes two incorrect DEFAULT_EXPORT_FORMATS entries (Forms → application/zip, Apps Script → application/vnd.google-apps.script+json), adds a VALID_EXPORT_FORMATS map sourced from Google Drive API docs to validate export requests before hitting the API, and introduces an "Auto" default that selects the best format per file type while sanitizing the sentinel value in both the block params and the route handler.

Confidence Score: 5/5

Safe to merge — all format fixes are correct per Google Drive API docs and the validation logic is sound.

All remaining findings are P2 UX suggestions. The core bug fixes (Forms/Apps Script default formats) are verified against the official docs, the validation logic correctly guards against invalid API calls, and the auto sanitization works correctly through both code paths. No data loss or runtime errors introduced.

apps/sim/blocks/blocks/google_drive.ts — the dropdown's HTML option will now surface a validation error for Sheets/Slides since the expected format is application/zip, not text/html.

Important Files Changed

Filename Overview
apps/sim/tools/google_drive/utils.ts Adds VALID_EXPORT_FORMATS map per Google Drive API docs; corrects DEFAULT_EXPORT_FORMATS for Forms (zip) and Apps Script (script+json). All 6 Workspace types are covered and default formats pass their own validation.
apps/sim/app/api/tools/google_drive/download/route.ts Adds pre-flight VALID_EXPORT_FORMATS check before calling Google's export API; sanitizes auto sentinel to null. Double-sanitization with the block's params function is intentional defense-in-depth.
apps/sim/blocks/blocks/google_drive.ts Adds "Auto" as default export format and converts autoundefined in params. The HTML dropdown option will now produce a validation error for Sheets/Slides since text/html is not in VALID_EXPORT_FORMATS for those types; application/zip is missing from the dropdown.

Reviews (3): Last reviewed commit: "fix(google-drive): add text/markdown to ..." | Re-trigger Greptile

@waleedlatif1 waleedlatif1 changed the title fix(google-drive): add auto export format and Azure storage debug logging fix(google-drive): add auto export format with fallback for incompatible conversions Apr 14, 2026
@waleedlatif1 waleedlatif1 force-pushed the waleedlatif1/azure-storage-debug branch from 82180e0 to 40f3b45 Compare April 14, 2026 21:32
@waleedlatif1 waleedlatif1 changed the title fix(google-drive): add auto export format with fallback for incompatible conversions fix(google-drive): add auto export format and validate against Drive API docs Apr 14, 2026
@waleedlatif1
Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1
Copy link
Copy Markdown
Collaborator Author

@cursor review

@waleedlatif1
Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1
Copy link
Copy Markdown
Collaborator Author

@cursor review

Copy link
Copy Markdown

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 291b2ee. Configure here.

@waleedlatif1 waleedlatif1 merged commit 48e174b into staging Apr 14, 2026
9 checks passed
@waleedlatif1 waleedlatif1 deleted the waleedlatif1/azure-storage-debug branch April 14, 2026 22:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant