File validation failed when using custon file types in input #6734

Closed
opened 2026-02-21 18:17:02 -05:00 by yindo · 9 comments
Owner

Originally created by @LiuBodong on GitHub (Nov 13, 2024).

Originally assigned to: @zxhlyh, @laipz8200 on GitHub.

Self Checks

  • This is only for bug report, if you would like to ask a question, please head to Discussions.
  • I have searched for existing issues search for existing issues, including closed ones.
  • I confirm that I am using English to submit this report (我已阅读并同意 Language Policy).
  • [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)
  • Please do not modify this template :) and fill in all the required fields.

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

图片

Originally created by @LiuBodong on GitHub (Nov 13, 2024). Originally assigned to: @zxhlyh, @laipz8200 on GitHub. ### Self Checks - [X] This is only for bug report, if you would like to ask a question, please head to [Discussions](https://github.com/langgenius/dify/discussions/categories/general). - [X] I have searched for existing issues [search for existing issues](https://github.com/langgenius/dify/issues), including closed ones. - [X] I confirm that I am using English to submit this report (我已阅读并同意 [Language Policy](https://github.com/langgenius/dify/issues/1542)). - [X] [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:) - [X] Please do not modify this template :) and fill in all the required fields. ### 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. ![图片](https://github.com/user-attachments/assets/a418f8b3-6a11-4ce4-96d7-1b427121a474) * run the work flow and choose a file, then start the flow. ![图片](https://github.com/user-attachments/assets/e53f2f53-e9fe-47e5-90cc-fd12d5874c0d) ### ✔️ Expected Behavior upload and validate correctly ### ❌ Actual Behavior ![图片](https://github.com/user-attachments/assets/442859cf-3275-4d5e-b259-0b696b6568cb)
yindo added the 🐞 bug label 2026-02-21 18:17:02 -05:00
yindo closed this issue 2026-02-21 18:17:03 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Nov 13, 2024):

@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.

@dosubot[bot] commented on GitHub (Nov 13, 2024): <!-- Greeting --> @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! <!-- Answer --> 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 <sup>[[1]](https://github.com/langgenius/dify/blob/main/web/app/components/workflow/nodes/_base/components/file-upload-setting.tsx)</sup>. 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 <sup>[[2]](https://github.com/langgenius/dify/blob/main/web/app/components/base/file-uploader/utils.ts)</sup>. To resolve this, ensure that the custom file types are specified without a leading dot in the input field configuration. <!-- Dosu Comment Footer --> *To continue talking to [Dosu](https://dosu.dev), mention @dosu.*
Author
Owner

@crazywoola commented on GitHub (Nov 13, 2024):

Why don't you just use the image type?

@crazywoola commented on GitHub (Nov 13, 2024): Why don't you just use the image type?
Author
Owner

@LiuBodong commented on GitHub (Nov 13, 2024):

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"]'

图片

@LiuBodong commented on GitHub (Nov 13, 2024): 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"]' ![图片](https://github.com/user-attachments/assets/5a9a89ab-f0f4-4f5a-9173-bfab2cba8dbe)
Author
Owner

@LiuBodong commented on GitHub (Nov 13, 2024):

Why don't you just use the image type?

cause i have to deal with image or a tar binary together

@LiuBodong commented on GitHub (Nov 13, 2024): > Why don't you just use the image type? cause i have to deal with image or a tar binary together
Author
Owner

@crazywoola commented on GitHub (Nov 13, 2024):

I think you can check 2 types, image and other.

@crazywoola commented on GitHub (Nov 13, 2024): I think you can check 2 types, image and other.
Author
Owner

@crazywoola commented on GitHub (Nov 13, 2024):

We had a fix recently #10111

@crazywoola commented on GitHub (Nov 13, 2024): We had a fix recently #10111
Author
Owner

@LiuBodong commented on GitHub (Nov 13, 2024):

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

@LiuBodong commented on GitHub (Nov 13, 2024): > 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"]' > > ![图片](https://private-user-images.githubusercontent.com/23203149/385635436-5a9a89ab-f0f4-4f5a-9173-bfab2cba8dbe.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzE0ODI3MDksIm5iZiI6MTczMTQ4MjQwOSwicGF0aCI6Ii8yMzIwMzE0OS8zODU2MzU0MzYtNWE5YTg5YWItZjBmNC00ZjVhLTkxNzMtYmZhYjJjYmE4ZGJlLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDExMTMlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQxMTEzVDA3MjAwOVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWNkZTg0YWFlZjZjOWMzNjkwODQzNGE5OGU3YTJlMWUwMzdiNjNjYmZlOWQ2ZGE3Zjc1MGJhNGFhYWRjZjNmMTkmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.h_nvTp1LWBbQGUdI27KqsLp0mgyYv7_04oRDE2D0r9U) please just check this code and have a test
Author
Owner

@laipz8200 commented on GitHub (Nov 14, 2024):

We are now processing this issue.

@laipz8200 commented on GitHub (Nov 14, 2024): We are now processing this issue.
Author
Owner

@qwfy326 commented on GitHub (Apr 24, 2025):

The bug is still exist if enabled the memory and talked more. The version is 1.3.0

@qwfy326 commented on GitHub (Apr 24, 2025): The bug is still exist if enabled the memory and talked more. The version is 1.3.0
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#6734