"File extension not supported" on uploading .md files in workflow
Self Checks
- [x] This is only for bug report, if you would like to ask a question, please head to Discussions.
- [x] I have searched for existing issues search for existing issues, including closed ones.
- [x] I confirm that I am using English to submit this report (我已阅读并同意 Language Policy).
- [x] [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)
- [x] Please do not modify this template :) and fill in all the required fields.
Dify version
1.0.0
Cloud or Self Hosted
Self Hosted (Docker), Cloud
Steps to reproduce
An error message appears: "File extension is not supported" on uploading a .md file in a workflow Some mistake on getting extension from mime, I think
Reproduction
- Platform: self hosted(docker), cloud.dify.ai
- Support File Types: Document, Custom(add .md)
✔️ Expected Behavior
No response
❌ Actual Behavior
No response
Hey there, @IFSimon! 👋 I'm here to help you with bug fixes, answer questions, and assist you while you wait for a human maintainer. Let's squash those bugs together!
The error message "File extension not supported" when uploading .md files in a self-hosted Docker workflow on Dify version 1.0.0 occurs because the .md extension is not included in the DOCUMENT_EXTENSIONS list. The upload_file method in FileService checks if the file extension is in DOCUMENT_EXTENSIONS when the source is "datasets". If it is not, it raises an UnsupportedFileTypeError [1].
To resolve this, you can add the .md extension to the DOCUMENT_EXTENSIONS list by modifying the api/constants/__init__.py file. Here's how you can do it:
- Open the
api/constants/__init__.pyfile. - Locate the
DOCUMENT_EXTENSIONSlist. - Add
"md"to the list of extensions. For example:
if dify_config.ETL_TYPE == "Unstructured":
DOCUMENT_EXTENSIONS = ["txt", "markdown", "md", "mdx", "pdf", "html", "htm", "xlsx", "xls"]
DOCUMENT_EXTENSIONS.extend(("doc", "docx", "csv", "eml", "msg", "pptx", "xml", "epub"))
if dify_config.UNSTRUCTURED_API_URL:
DOCUMENT_EXTENSIONS.append("ppt")
DOCUMENT_EXTENSIONS.extend([ext.upper() for ext in DOCUMENT_EXTENSIONS])
else:
DOCUMENT_EXTENSIONS = ["txt", "markdown", "md", "mdx", "pdf", "html", "htm", "xlsx", "xls", "docx", "csv"]
DOCUMENT_EXTENSIONS.extend([ext.upper() for ext in DOCUMENT_EXTENSIONS])
This will ensure that .md files are supported in your workflow [2].
To continue talking to Dosu, mention @dosu.
Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Bug Report | Other
I can't reproduce in my environment
I have same problem with txt extention, other extention i have not tried yet.
Dify version 1.0.0
Cloud or Self Hosted Self Hosted (Docker) + windows
my chatflow like
I can upload txt in preview like blow, and the output shows model can not read uploaded file.
I can choose txt correctly in preview.
After the app published, i can not upload txt file like :
when i drag & drop a txt file, it shows the hint "File extension not supported"
Hi, @IFSimon. I'm Dosu, and I'm helping the Dify team manage their backlog. I'm marking this issue as stale.
Issue Summary:
- You reported a bug with uploading .md files resulting in an unsupported file extension error.
- Suggested resolution involves modifying
api/constants/__init__.pyto include .md inDOCUMENT_EXTENSIONS. - @kenwoodjw was unable to reproduce the issue.
- @Thanatos-L reported a similar issue with .txt files on a self-hosted Docker setup.
Next Steps:
- Please confirm if this issue is still relevant to the latest version of the Dify repository by commenting here.
- If no updates are provided, the issue will be automatically closed in 15 days.
Thank you for your understanding and contribution!
@IFSimon @Thanatos-L Is this method helpful? issues #17967
- Updated the Dify version to 1.1.3
- I also used "PyMuPDF" in conjunction with "Doc Extractor"