Skip to content

Commit

Permalink
@uppy/companion: increase max limits for remote file list operations (#…
Browse files Browse the repository at this point in the history
…4417)

* increase max limits for list operations

* fix broken test

* pageSize won't work until we get rid of permissions field

* Revert "fix broken test"

This reverts commit 70daa70.

---------

Co-authored-by: Artur Paikin <[email protected]>
  • Loading branch information
mifi and arturi authored Apr 18, 2023
1 parent 96ae2bf commit 80a8275
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
11 changes: 11 additions & 0 deletions packages/@uppy/companion/src/server/provider/drive/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,17 @@ class Drive extends Provider {
fields: DRIVE_FILES_FIELDS,
pageToken: query.cursor,
q,
// pageSize: The maximum number of files to return per page.
// Partial or empty result pages are possible even before the end of the files list has been reached.
// Acceptable values are 1 to 1000, inclusive. (Default: 100)
//
// @TODO:
// SAD WARNING: doesn’t work if you have multiple `fields`, defaults to 100 anyway.
// Works if we remove `permissions(role,emailAddress)`, which we use to set the email address
// of logged in user in the Provider View header on the frontend.
// See https://stackoverflow.com/questions/42592125/list-request-page-size-being-ignored
//
// pageSize: 1000,
// pageSize: 10, // can be used for testing pagination if you don't have many files
orderBy: 'folder,name',
includeItemsFromAllDrives: true,
Expand Down
11 changes: 10 additions & 1 deletion packages/@uppy/companion/src/server/provider/dropbox/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,16 @@ async function list ({ directory, query, token }) {
return getClient({ token }).post('files/list_folder/continue', { json: { cursor: query.cursor }, responseType: 'json' }).json()
}

return getClient({ token }).post('files/list_folder', { searchParams: query, json: { path: `${directory || ''}`, include_non_downloadable_files: false }, responseType: 'json' }).json()
return getClient({ token }).post('files/list_folder', {
searchParams: query,
json: {
path: `${directory || ''}`,
include_non_downloadable_files: false,
// min=1, max=2000 (default: 500): The maximum number of results to return per request.
limit: 2000,
},
responseType: 'json',
}).json()
}

async function userInfo ({ token }) {
Expand Down

0 comments on commit 80a8275

Please sign in to comment.