Skip to content

Commit 80bb8ed

Browse files
fix(file): require isActive in tool params type, reject multiple files in manage sharing
- FileManageSharingParams.isActive is now required, matching the tool param and contract (no compile-time gap that 400s at runtime) - manage_sharing rejects multiple canonical file IDs instead of silently sharing only the first, matching decompress
1 parent e9e8839 commit 80bb8ed

3 files changed

Lines changed: 15 additions & 1 deletion

File tree

apps/sim/blocks/blocks/file.test.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,4 +205,15 @@ describe('FileV5Block', () => {
205205
'File is required to manage sharing'
206206
)
207207
})
208+
209+
it('rejects multiple file IDs for manage sharing', () => {
210+
expect(() =>
211+
buildParams({
212+
operation: 'file_manage_sharing',
213+
shareInput: '["file-1","file-2"]',
214+
shareVisibility: 'public',
215+
_context: { workspaceId: 'workspace-1' },
216+
})
217+
).toThrow('Manage Sharing accepts a single file at a time')
218+
})
208219
})

apps/sim/blocks/blocks/file.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1211,6 +1211,9 @@ export const FileV5Block: BlockConfig<FileParserV3Output> = {
12111211
let fileId: string
12121212
const fileIds = parseReadFileIds(shareInput)
12131213
if (fileIds) {
1214+
if (Array.isArray(fileIds) && fileIds.length > 1) {
1215+
throw new Error('Manage Sharing accepts a single file at a time')
1216+
}
12141217
fileId = Array.isArray(fileIds) ? fileIds[0] : fileIds
12151218
} else {
12161219
const normalized = normalizeFileInput(shareInput, { single: true })

apps/sim/tools/file/manage-sharing.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import type { ToolConfig, ToolResponse, WorkflowToolExecutionContext } from '@/t
33

44
interface FileManageSharingParams {
55
fileId: string
6-
isActive?: boolean
6+
isActive: boolean
77
authType?: ShareAuthType
88
password?: string
99
allowedEmails?: string[]

0 commit comments

Comments
 (0)