(filename: string)
| 99 | * @returns {void} Throws an error if validation fails |
| 100 | */ |
| 101 | const 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 |
no test coverage detected