(mime: string)
| 1272 | * @returns {boolean} |
| 1273 | */ |
| 1274 | export const isAllowedUploadMimeType = (mime: string): boolean => { |
| 1275 | if (!mime || typeof mime !== 'string') return false |
| 1276 | const trimmed = mime.trim() |
| 1277 | if (!trimmed) return false |
| 1278 | return ALLOWED_UPLOAD_MIME_TYPES.has(trimmed) && mapMimeTypeToExt(trimmed) !== '' |
| 1279 | } |
| 1280 | |
| 1281 | // remove invalid markdown image pattern:  |
| 1282 | // Uses indexOf instead of a global regex to avoid O(n²) backtracking when the |
no test coverage detected