Skip to content

Commit 47c9604

Browse files
committed
update single file blocks
1 parent ff0753a commit 47c9604

File tree

16 files changed

+75
-47
lines changed

16 files changed

+75
-47
lines changed

apps/sim/blocks/blocks/confluence.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -652,7 +652,7 @@ export const ConfluenceV2Block: BlockConfig<ConfluenceResponse> = {
652652

653653
if (operation === 'upload_attachment') {
654654
const fileInput = attachmentFileUpload || attachmentFileReference || attachmentFile
655-
const normalizedFile = normalizeFileInput(fileInput)
655+
const normalizedFile = normalizeFileInput(fileInput, { single: true })
656656
if (!normalizedFile) {
657657
throw new Error('File is required for upload attachment operation.')
658658
}

apps/sim/blocks/blocks/dropbox.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ Return ONLY the timestamp string - no explanations, no quotes, no extra text.`,
320320
// Normalize file input for upload operation
321321
// normalizeFileInput handles JSON stringified values from advanced mode
322322
if (params.fileContent) {
323-
params.fileContent = normalizeFileInput(params.fileContent)
323+
params.fileContent = normalizeFileInput(params.fileContent, { single: true })
324324
}
325325

326326
switch (params.operation) {

apps/sim/blocks/blocks/fireflies.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -620,12 +620,12 @@ export const FirefliesV2Block: BlockConfig<FirefliesResponse> = {
620620
}
621621

622622
if (params.operation === 'fireflies_upload_audio') {
623-
const audioFiles =
624-
normalizeFileInput(params.audioFile) || normalizeFileInput(params.audioFileReference)
625-
if (!audioFiles || audioFiles.length === 0) {
623+
const audioFile =
624+
normalizeFileInput(params.audioFile, { single: true }) ||
625+
normalizeFileInput(params.audioFileReference, { single: true })
626+
if (!audioFile) {
626627
throw new Error('Audio file is required.')
627628
}
628-
const audioFile = audioFiles[0]
629629
const audioUrl = resolveHttpsUrlFromFileInput(audioFile)
630630
if (!audioUrl) {
631631
throw new Error('Audio file must include a https URL.')

apps/sim/blocks/blocks/google_drive.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -793,7 +793,7 @@ Return ONLY the message text - no subject line, no greetings/signatures, no extr
793793
} = params
794794

795795
// Normalize file input - handles both basic (file-upload) and advanced (short-input) modes
796-
const normalizedFile = normalizeFileInput(file ?? fileUpload)
796+
const normalizedFile = normalizeFileInput(file ?? fileUpload, { single: true })
797797

798798
// Use folderSelector if provided, otherwise use manualFolderId
799799
const effectiveFolderId = (folderSelector || manualFolderId || '').trim()

apps/sim/blocks/blocks/linear.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1775,10 +1775,10 @@ Return ONLY the date string in YYYY-MM-DD format - no explanations, no quotes, n
17751775
throw new Error('Issue ID is required.')
17761776
}
17771777
// Normalize file inputs - handles JSON stringified values from advanced mode
1778-
const normalizedUpload = normalizeFileInput(params.attachmentFileUpload)
1779-
const normalizedFile = normalizeFileInput(params.file)
17801778
// Take the first file from whichever input has data (Linear only accepts single file)
1781-
const attachmentFile = normalizedUpload?.[0] || normalizedFile?.[0]
1779+
const attachmentFile =
1780+
normalizeFileInput(params.attachmentFileUpload, { single: true }) ||
1781+
normalizeFileInput(params.file, { single: true })
17821782
// Check for multiple files
17831783
if (
17841784
(normalizedUpload && normalizedUpload.length > 1) ||

apps/sim/blocks/blocks/onedrive.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,7 @@ export const OneDriveBlock: BlockConfig<OneDriveResponse> = {
371371
}
372372

373373
// Normalize file input from both basic (file-upload) and advanced (short-input) modes
374-
const normalizedFile = normalizeFileInput(file || fileReference)
374+
const normalizedFile = normalizeFileInput(file || fileReference, { single: true })
375375

376376
return {
377377
credential,

apps/sim/blocks/blocks/s3.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ export const S3Block: BlockConfig<S3Response> = {
273273
}
274274
// Use file from uploadFile if in basic mode, otherwise use file reference
275275
// normalizeFileInput handles JSON stringified values from advanced mode
276-
const fileParam = normalizeFileInput(params.uploadFile || params.file)
276+
const fileParam = normalizeFileInput(params.uploadFile || params.file, { single: true })
277277

278278
return {
279279
accessKeyId: params.accessKeyId,

apps/sim/blocks/blocks/spotify.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -788,7 +788,7 @@ export const SpotifyBlock: BlockConfig<ToolResponse> = {
788788
}
789789
// Normalize file input for cover image
790790
if (params.coverImage !== undefined) {
791-
params.coverImage = normalizeFileInput(params.coverImage)
791+
params.coverImage = normalizeFileInput(params.coverImage, { single: true })
792792
}
793793
return params.operation || 'spotify_search'
794794
},

apps/sim/blocks/blocks/stt.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -260,8 +260,9 @@ export const SttBlock: BlockConfig<SttBlockResponse> = {
260260
},
261261
params: (params) => {
262262
// Normalize file input from basic (file-upload) or advanced (short-input) mode
263-
const normalizedFiles = normalizeFileInput(params.audioFile || params.audioFileReference)
264-
const audioFile = normalizedFiles?.[0]
263+
const audioFile = normalizeFileInput(params.audioFile || params.audioFileReference, {
264+
single: true,
265+
})
265266

266267
return {
267268
provider: params.provider,
@@ -393,8 +394,9 @@ export const SttV2Block: BlockConfig<SttBlockResponse> = {
393394
}),
394395
params: (params) => {
395396
// Normalize file input from basic (file-upload) or advanced (short-input) mode
396-
const normalizedFiles = normalizeFileInput(params.audioFile || params.audioFileReference)
397-
const audioFile = normalizedFiles?.[0]
397+
const audioFile = normalizeFileInput(params.audioFile || params.audioFileReference, {
398+
single: true,
399+
})
398400

399401
return {
400402
provider: params.provider,

apps/sim/blocks/blocks/supabase.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -982,7 +982,9 @@ Return ONLY the PostgREST filter expression - no explanations, no markdown, no e
982982

983983
// Normalize file input for storage_upload operation
984984
// normalizeFileInput handles JSON stringified values from advanced mode
985-
const normalizedFileData = normalizeFileInput(file || fileContent || fileData)
985+
const normalizedFileData = normalizeFileInput(file || fileContent || fileData, {
986+
single: true,
987+
})
986988

987989
// Parse JSON data if it's a string
988990
let parsedData

0 commit comments

Comments
 (0)