Skip to content

Commit c526eed

Browse files
committed
fix(dropbox): list_shared_links path omission + list_revisions pagination
Cursor Bugbot flagged two real gaps: - list_shared_links sent path: "" for root/all, but Dropbox only returns every link account-wide when path is omitted entirely; "" scopes to the root folder specifically. Now omits the field for root/empty/"/" input. - list_revisions exposed hasMore but no way to actually fetch more pages (Dropbox's before_rev cursor). Added a beforeRev param + advanced-mode block field. A third flagged issue (create_shared_link's error.shared_link_already_exists.metadata path) was verified against the official sharing.stone spec and confirmed correct as-is - replied on the PR thread with the citation, no change needed.
1 parent 8550471 commit c526eed

4 files changed

Lines changed: 35 additions & 6 deletions

File tree

apps/sim/blocks/blocks/dropbox.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -334,6 +334,14 @@ Return ONLY the timestamp string - no explanations, no quotes, no extra text.`,
334334
condition: { field: 'operation', value: 'dropbox_list_revisions' },
335335
mode: 'advanced',
336336
},
337+
{
338+
id: 'beforeRev',
339+
title: 'Before Revision',
340+
type: 'short-input',
341+
placeholder: 'Revision from a previous call, to fetch the next page',
342+
condition: { field: 'operation', value: 'dropbox_list_revisions' },
343+
mode: 'advanced',
344+
},
337345
// Restore operation inputs
338346
{
339347
id: 'path',
@@ -442,6 +450,8 @@ Return ONLY the timestamp string - no explanations, no quotes, no extra text.`,
442450
maxResults: { type: 'number', description: 'Maximum search results' },
443451
// List shared links inputs
444452
directOnly: { type: 'boolean', description: 'Only return direct links, not parent folders' },
453+
// List revisions input
454+
beforeRev: { type: 'string', description: 'Fetch revisions before this one (pagination)' },
445455
// Restore input
446456
rev: { type: 'string', description: 'Revision identifier to restore' },
447457
},

apps/sim/tools/dropbox/list_revisions.ts

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,13 @@ export const dropboxListRevisionsTool: ToolConfig<
3131
visibility: 'user-only',
3232
description: 'Maximum number of revisions to return, 1-100 (default: 10)',
3333
},
34+
beforeRev: {
35+
type: 'string',
36+
required: false,
37+
visibility: 'user-only',
38+
description:
39+
'Only return revisions before this one. Pass the rev of the last revision from a previous call to fetch the next page.',
40+
},
3441
},
3542

3643
request: {
@@ -45,11 +52,17 @@ export const dropboxListRevisionsTool: ToolConfig<
4552
'Content-Type': 'application/json',
4653
}
4754
},
48-
body: (params) => ({
49-
path: params.path.trim(),
50-
mode: 'path',
51-
limit: params.limit ?? 10,
52-
}),
55+
body: (params) => {
56+
const body: Record<string, any> = {
57+
path: params.path.trim(),
58+
mode: 'path',
59+
limit: params.limit ?? 10,
60+
}
61+
if (params.beforeRev) {
62+
body.before_rev = params.beforeRev.trim()
63+
}
64+
return body
65+
},
5366
},
5467

5568
transformResponse: async (response) => {

apps/sim/tools/dropbox/list_shared_links.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,12 @@ export const dropboxListSharedLinksTool: ToolConfig<
5555
const body: Record<string, any> = {}
5656
if (params.path) {
5757
const trimmedPath = params.path.trim()
58-
body.path = trimmedPath === '/' ? '' : trimmedPath
58+
// Dropbox only returns every shared link on the account when `path` is omitted
59+
// entirely; sending "" scopes the results to the root folder instead. Since our UI
60+
// tells users "/" means "list all links", omit the field rather than sending "".
61+
if (trimmedPath !== '/' && trimmedPath !== '') {
62+
body.path = trimmedPath
63+
}
5964
}
6065
if (params.directOnly !== undefined) body.direct_only = params.directOnly
6166
if (params.cursor) body.cursor = params.cursor

apps/sim/tools/dropbox/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,7 @@ interface DropboxFileRevision {
264264
export interface DropboxListRevisionsParams extends DropboxBaseParams {
265265
path: string
266266
limit?: number
267+
beforeRev?: string
267268
}
268269

269270
export interface DropboxListRevisionsResponse extends ToolResponse {

0 commit comments

Comments
 (0)