MCPcopy Index your code
hub / github.com/simstudioai/sim / sanitizeStorageMetadata

Function sanitizeStorageMetadata

apps/sim/lib/uploads/utils/file-utils.ts:830–845  ·  view source on GitHub ↗
(
  metadata: Record<string, string>,
  maxLength: number
)

Source from the content-addressed store, hash-verified

828 * @returns Sanitized metadata object
829 */
830export function sanitizeStorageMetadata(
831 metadata: Record<string, string>,
832 maxLength: number
833): Record<string, string> {
834 const sanitized: Record<string, string> = {}
835 for (const [key, value] of Object.entries(metadata)) {
836 const sanitizedValue = String(value)
837 .replace(/[^\x20-\x7E]/g, '')
838 .replace(/["\\]/g, '')
839 .substring(0, maxLength)
840 if (sanitizedValue) {
841 sanitized[key] = sanitizedValue
842 }
843 }
844 return sanitized
845}
846
847/**
848 * Sanitize a file key/path for local storage

Callers 3

uploadToBlobFunction · 0.90
uploadToS3Function · 0.90
generateS3PresignedUrlFunction · 0.90

Calls 1

replaceMethod · 0.65

Tested by

no test coverage detected