diff --git a/api/services/file_service.py b/api/services/file_service.py index 27f9527134..fb61bfa9be 100644 --- a/api/services/file_service.py +++ b/api/services/file_service.py @@ -133,7 +133,15 @@ class FileService: # extract text from file extension = upload_file.extension - if extension.lower() not in ALLOWED_EXTENSIONS: + etl_type = current_app.config['ETL_TYPE'] + if etl_type == 'Unstructured': + allowed_extensions = ['txt', 'markdown', 'md', 'pdf', 'html', 'htm', 'xlsx', + 'docx', 'csv', 'eml', 'msg', 'pptx', 'ppt', 'xml', + 'jpg', 'jpeg', 'png', 'webp', 'gif', 'svg'] + else: + allowed_extensions = ['txt', 'markdown', 'md', 'pdf', 'html', 'htm', 'xlsx', 'docx', 'csv', + 'jpg', 'jpeg', 'png', 'webp', 'gif', 'svg'] + if extension.lower() not in allowed_extensions: raise UnsupportedFileTypeError() text = FileExtractor.load(upload_file, return_text=True)