MCPcopy Index your code
hub / github.com/FlowiseAI/Flowise / validateFilename

Function validateFilename

packages/components/src/validator.ts:101–108  ·  view source on GitHub ↗
(filename: string)

Source from the content-addressed store, hash-verified

99 * @returns {void} Throws an error if validation fails
100 */
101const validateFilename = (filename: string): void => {
102 if (!filename || typeof filename !== 'string') {
103 throw new Error('Invalid filename: filename is required and must be a string')
104 }
105 if (isUnsafeFilePath(filename)) {
106 throw new Error(`Invalid filename: unsafe characters or path traversal attempt detected in filename "${filename}"`)
107 }
108}
109
110/**
111 * Extracts and normalizes file extension from filename

Callers 1

Calls 1

isUnsafeFilePathFunction · 0.85

Tested by

no test coverage detected