Skip to content

feat(google-drive-picker): add selectFolders option to control folder selection#6385

Open
EnverUsta wants to merge 1 commit into
transloadit:mainfrom
EnverUsta:google-drive-picker-select-folders
Open

feat(google-drive-picker): add selectFolders option to control folder selection#6385
EnverUsta wants to merge 1 commit into
transloadit:mainfrom
EnverUsta:google-drive-picker-select-folders

Conversation

@EnverUsta

@EnverUsta EnverUsta commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Summary

The Google Drive Picker enables folder selection unconditionally, but the plugin uses the narrow drive.file OAuth scope. Under drive.file, an app can only access files the user explicitly picks, selecting a folder does not grant access to its contents. So when a user selects a folder, listing it returns only the files the app already had per-file access to (often none), and the selection appears to do nothing.

Reading arbitrary folder contents would require a restricted scope (drive.readonly/drive), which triggers Google's security assessment (CASA), something many integrators specifically use this picker to avoid.

This PR makes folder selection opt-in:

  • Adds a selectFolders option (default false) to @uppy/google-drive-picker.
  • Folders remain visible for navigation (setIncludeFolders(true) stays unconditional); only folder selection (setSelectFolderEnabled) is gated by the option.
  • When selectFolders: true and a picked folder resolves to zero files, the user sees an ambiguity-aware warning — under drive.file, "empty folder" and "no access to the folder's contents" are indistinguishable.
  • Keeps the drive.file scope unchanged.

Behavior change

Folder selection previously defaulted on but couldn't work reliably under drive.file. It now defaults off; set selectFolders: true to re-enable it. Captured in the changeset (@uppy/google-drive-picker minor, @uppy/core patch).

Testing

  • Added unit tests for showDrivePicker (6 tests, all passing).
  • yarn workspace @uppy/core typecheck and @uppy/google-drive-picker typecheck clean.

@changeset-bot

changeset-bot Bot commented Jul 21, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: f4737e2

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
@uppy/core Patch
@uppy/google-drive-picker Minor
uppy Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@EnverUsta
EnverUsta force-pushed the google-drive-picker-select-folders branch from 02e5292 to f4737e2 Compare July 21, 2026 12:42
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.

2 participants