mirror of
https://git.mirrors.martin98.com/https://github.com/langgenius/dify.git
synced 2025-08-12 03:39:01 +08:00
fix file type not support when preview (#1841)
Co-authored-by: jyong <jyong@dify.ai>
This commit is contained in:
parent
9080ece3fb
commit
08494058e9
@ -133,7 +133,15 @@ class FileService:
|
|||||||
|
|
||||||
# extract text from file
|
# extract text from file
|
||||||
extension = upload_file.extension
|
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()
|
raise UnsupportedFileTypeError()
|
||||||
|
|
||||||
text = FileExtractor.load(upload_file, return_text=True)
|
text = FileExtractor.load(upload_file, return_text=True)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user