MCPcopy Index your code
hub / github.com/deepnote/deepnote / validateNoBomPrefix

Function validateNoBomPrefix

packages/blocks/src/deepnote-file/parse-yaml.ts:44–49  ·  view source on GitHub ↗

* Validates that a string doesn't start with BOM. * Note: This is a fallback when only a string is available. * By the time we have a JS string, invalid UTF-8 has already been handled during decoding. * For proper UTF-8 validation, use decodeUtf8NoBom() on raw bytes before decoding. * * @param

(yamlContent: string)

Source from the content-addressed store, hash-verified

42 * @throws EncodingError if BOM prefix detected
43 */
44function validateNoBomPrefix(yamlContent: string): void {
45 // Check for UTF-8 BOM that was decoded as U+FEFF
46 if (yamlContent.charCodeAt(0) === 0xfeff) {
47 throw new EncodingError('UTF-8 BOM detected in Deepnote file - files must be UTF-8 without BOM')
48 }
49}
50
51/**
52 * Validates that the YAML document doesn't contain prohibited features:

Callers 1

parseYamlFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected