MCPcopy Create free account
hub / github.com/AnukarOP/claude-code-leaked / isBase64ImageBlock

Function isBase64ImageBlock

source code/utils/imageValidation.ts:42–51  ·  view source on GitHub ↗

* Type guard to check if a block is a base64 image block

(
  block: unknown,
)

Source from the content-addressed store, hash-verified

40 * Type guard to check if a block is a base64 image block
41 */
42function isBase64ImageBlock(
43 block: unknown,
44): block is { type: 'image'; source: { type: 'base64'; data: string } } {
45 if (typeof block !== 'object' || block === null) return false
46 const b = block as Record<string, unknown>
47 if (b.type !== 'image') return false
48 if (typeof b.source !== 'object' || b.source === null) return false
49 const source = b.source as Record<string, unknown>
50 return source.type === 'base64' && typeof source.data === 'string'
51}
52
53/**
54 * Validates that all images in messages are within the API size limit.

Callers 1

validateImagesForAPIFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected