| 12345678910111213141516171819202122232425 |
- export const DOC_EXTENSIONS = ['pdf', 'doc', 'docx', 'xls', 'xlsx', 'ppt', 'pptx', 'rtf', 'csv', 'txt', 'md', 'html', 'json', 'xml', 'odt', 'ods', 'odp'];
- export const CODE_EXTENSIONS = ['js', 'jsx', 'ts', 'tsx', 'css', 'py', 'java', 'sql', 'cpp', 'h', 'go', 'rs', 'php', 'rb'];
- export const IMAGE_EXTENSIONS = ['jpg', 'jpeg', 'png', 'gif', 'bmp', 'webp', 'tiff'];
- export const IMAGE_MIME_TYPES = ['image/jpeg', 'image/png', 'image/gif', 'image/bmp', 'image/webp', 'image/tiff'];
- export const KB_ALLOWED_EXTENSIONS = [...DOC_EXTENSIONS, ...CODE_EXTENSIONS, ...IMAGE_EXTENSIONS];
- export const GROUP_ALLOWED_EXTENSIONS = [...DOC_EXTENSIONS, ...CODE_EXTENSIONS, ...IMAGE_EXTENSIONS];
- export const isExtensionAllowed = (ext: string, type: 'kb' | 'group'): boolean => {
- const normalizedExt = ext.toLowerCase().replace('.', '');
- if (type === 'kb') {
- return KB_ALLOWED_EXTENSIONS.includes(normalizedExt);
- }
- return GROUP_ALLOWED_EXTENSIONS.includes(normalizedExt);
- };
- export const getSupportedFormatsLabel = (type: 'kb' | 'group'): string => {
- return 'PDF, Word, Excel, PPT, TXT, MD, Code(JS/TS/PY...), Images...';
- };
- export const isFormatSupportedForPreview = (filename: string): boolean => {
- const ext = filename.toLowerCase().split('.').pop() || '';
- return [...DOC_EXTENSIONS, ...IMAGE_EXTENSIONS].includes(ext);
- };
|