Open LiuBodong opened 1 day ago
@LiuBodong Hello there! I'm here to assist you with any bugs, questions, or contributions you may have regarding Dify. Let's dive in and tackle this issue together!
File validation may fail when using custom file types in Dify version 0.11.1 due to how custom file extensions are handled. The code processes custom file types by removing the leading dot if present. This means that if custom file types are provided with a leading dot (e.g., ".txt"), they are stored without the dot (e.g., "txt"). If the validation logic elsewhere expects the file extensions to include the dot, this discrepancy could lead to validation failures [1].
The backend validation logic for file extensions does not expect them to include a leading dot. The getFileExtension
function extracts the file extension without a leading dot [2].
To resolve this, ensure that the custom file types are specified without a leading dot in the input field configuration.
To continue talking to Dosu, mention @dosu.
Why don't you just use the image type?
When validate file extensions, the file extension contains a 'dot', such as: '.png', '.jpg'. but the "allowed_extensions" array DO NOT contains the 'dot', it looks like '["png", "jpg"]'
Why don't you just use the image type?
cause i have to deal with image or a tar binary together
I think you can check 2 types, image and other.
We had a fix recently #10111
I think you can check 2 types, image and other.
When validate file extensions, the file extension contains a 'dot', such as: '.png', '.jpg'. but the "allowed_extensions" array DO NOT contains the 'dot', it looks like '["png", "jpg"]'
please just check this code and have a test
We are now processing this issue.
Self Checks
Dify version
0.11.1
Cloud or Self Hosted
Self Hosted (Docker), Self Hosted (Source)
Steps to reproduce
create a work flow with a start node and a end node.
create a file list input field in start node.
run the work flow and choose a file, then start the flow.
✔️ Expected Behavior
upload and validate correctly
❌ Actual Behavior