Skip to content

Commit c160878

Browse files
committed
improvement(integrations): expose vanta upload mime type in block and align fileContent bound with the 100MB cap
1 parent 4e3d257 commit c160878

2 files changed

Lines changed: 18 additions & 1 deletion

File tree

apps/sim/blocks/blocks/vanta.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,14 @@ export const VantaBlock: BlockConfig<ToolResponse> = {
184184
condition: { field: 'operation', value: 'upload_document_file' },
185185
mode: 'advanced',
186186
},
187+
{
188+
id: 'uploadMimeType',
189+
title: 'MIME Type',
190+
type: 'short-input',
191+
placeholder: 'e.g., application/pdf (used when the file has no type of its own)',
192+
condition: { field: 'operation', value: 'upload_document_file' },
193+
mode: 'advanced',
194+
},
187195
{
188196
id: 'uploadDescription',
189197
title: 'Description',
@@ -820,6 +828,7 @@ export const VantaBlock: BlockConfig<ToolResponse> = {
820828
const normalizedFile = normalizeFileInput(rest.file, { single: true })
821829
if (normalizedFile) result.file = normalizedFile
822830
result.fileName = optionalString(rest.uploadFileName)
831+
result.mimeType = optionalString(rest.uploadMimeType)
823832
result.description = optionalString(rest.uploadDescription)
824833
result.effectiveAtDate = optionalString(rest.effectiveAtDate)
825834
break
@@ -882,6 +891,10 @@ export const VantaBlock: BlockConfig<ToolResponse> = {
882891
uploadedFileId: { type: 'string', description: 'Uploaded file ID' },
883892
file: { type: 'json', description: 'Evidence file to upload' },
884893
uploadFileName: { type: 'string', description: 'Optional file name override' },
894+
uploadMimeType: {
895+
type: 'string',
896+
description: 'MIME type override used when the uploaded content has no type of its own',
897+
},
885898
uploadDescription: { type: 'string', description: 'Description of the uploaded evidence' },
886899
effectiveAtDate: { type: 'string', description: 'Effective date of the document (ISO 8601)' },
887900
frameworkMatchesAny: { type: 'string', description: 'Comma-separated framework ID filters' },

apps/sim/lib/api/contracts/tools/vanta.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -673,12 +673,16 @@ export const vantaQueryContract = defineRouteContract({
673673
response: { mode: 'json', schema: vantaQueryResponseSchema },
674674
})
675675

676+
const VANTA_MAX_UPLOAD_BYTES = 100 * 1024 * 1024
677+
/** Base64 length of the largest allowed upload (4 chars per 3 bytes). */
678+
const VANTA_MAX_UPLOAD_BASE64_LENGTH = Math.ceil(VANTA_MAX_UPLOAD_BYTES / 3) * 4
679+
676680
export const vantaUploadBodySchema = vantaBaseBodySchema.extend({
677681
documentId: requiredId('Document ID'),
678682
file: FileInputSchema.optional().nullable(),
679683
fileContent: z
680684
.string()
681-
.max(140 * 1024 * 1024, 'fileContent exceeds the 100MB upload limit')
685+
.max(VANTA_MAX_UPLOAD_BASE64_LENGTH, 'fileContent exceeds the 100MB upload limit')
682686
.nullish(),
683687
fileName: z.string().nullish(),
684688
mimeType: z.string().nullish(),

0 commit comments

Comments
 (0)