Validation error when trying to allow non-TXT/PDF file uploads (e.g., .sh, .php, .py, .ps1), causing failure to validate #8019

Closed
opened 2026-02-21 18:23:30 -05:00 by yindo · 2 comments
Owner

Originally created by @satoshi-st4 on GitHub (Feb 6, 2025).

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

1.0.0-beta.1

Cloud or Self Hosted

Self Hosted (Source), Self Hosted (Docker)

Steps to reproduce

  1. Navigate to the “File Upload” settings in Dify (screenshot as attached).
    Image
  2. Attempt to configure additional file types such as .sh, .php, .py, or .ps1 in the file upload settings (i.e., under “他のファイルタイプ” or a similar option).
  3. Try to validate and save these new file type settings.
    Image
  4. Observe a validation error that prevents saving.

✔️ Expected Behavior

  • It should be possible to directly add and validate .sh, .php, .py, and .ps1 (and other non-TXT/PDF) file types without triggering a validation error.

Actual Behavior

  • When adding these file types (.sh, .php, .py, .ps1) to the supported list, the system throws a validation error and does not allow saving.
Originally created by @satoshi-st4 on GitHub (Feb 6, 2025). ### 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 1.0.0-beta.1 ### Cloud or Self Hosted Self Hosted (Source), Self Hosted (Docker) ### Steps to reproduce 1. Navigate to the “File Upload” settings in Dify (screenshot as attached). ![Image](https://github.com/user-attachments/assets/cab86c73-3964-4620-b2ca-09d4e92df67a) 2. Attempt to configure additional file types such as `.sh`, `.php`, `.py`, or `.ps1` in the file upload settings (i.e., under “他のファイルタイプ” or a similar option). 3. Try to validate and save these new file type settings. ![Image](https://github.com/user-attachments/assets/51318627-91ed-4e69-acb7-875bf687ee9c) 5. Observe a validation error that prevents saving. ### ✔️ Expected Behavior - It should be possible to directly add and validate `.sh`, `.php`, `.py`, and `.ps1` (and other non-TXT/PDF) file types without triggering a validation error. ### ❌ Actual Behavior - When adding these file types (`.sh`, `.php`, `.py`, `.ps1`) to the supported list, the system throws a validation error and does not allow saving.
yindo added the 🐞 bug label 2026-02-21 18:23:30 -05:00
yindo closed this issue 2026-02-21 18:23:30 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Feb 6, 2025):

@satoshi-st4 こんにちは! I'm here to help you with any bugs, questions, or contributions you have for Dify. Let's work together to solve this issue!

To resolve the validation error when trying to allow non-TXT/PDF file uploads such as .sh, .php, .py, and .ps1, you need to modify the allowed_file_extensions in the FileUploadSetting component. You can achieve this by using the handleCustomFileTypesChange function to specify these custom file extensions.

Here's how you can update the custom file types:

const handleCustomFileTypesChange = useCallback((customFileTypes: string[]) => {
  const newPayload = produce(payload, (draft) => {
    draft.allowed_file_extensions = customFileTypes.map((v) => {
      return v
    })
  })
  onChange(newPayload)
}, [onChange, payload])

// Example usage to allow .sh, .php, .py, and .ps1 files
handleCustomFileTypesChange(['.sh', '.php', '.py', '.ps1']);

This code snippet updates the allowed_file_extensions to include the desired file types, which should resolve the validation error for these file uploads [1].

To continue talking to Dosu, mention @dosu.


Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Other

@dosubot[bot] commented on GitHub (Feb 6, 2025): <!-- Greeting --> @satoshi-st4 こんにちは! I'm here to help you with any bugs, questions, or contributions you have for Dify. Let's work together to solve this issue! <!-- Answer --> To resolve the validation error when trying to allow non-TXT/PDF file uploads such as `.sh`, `.php`, `.py`, and `.ps1`, you need to modify the `allowed_file_extensions` in the `FileUploadSetting` component. You can achieve this by using the `handleCustomFileTypesChange` function to specify these custom file extensions. Here's how you can update the custom file types: ```tsx const handleCustomFileTypesChange = useCallback((customFileTypes: string[]) => { const newPayload = produce(payload, (draft) => { draft.allowed_file_extensions = customFileTypes.map((v) => { return v }) }) onChange(newPayload) }, [onChange, payload]) // Example usage to allow .sh, .php, .py, and .ps1 files handleCustomFileTypesChange(['.sh', '.php', '.py', '.ps1']); ``` This code snippet updates the `allowed_file_extensions` to include the desired file types, which should resolve the validation error for these file uploads <sup>[[1]](https://github.com/langgenius/dify/blob/main/web/app/components/workflow/nodes/_base/components/file-upload-setting.tsx)</sup>. <!-- Dosu Comment Footer --> *To continue talking to [Dosu](https://dosu.dev), mention @dosu.* --- <sup>Help Dosu learn! Give it feedback: [Great Response](https://app.dosu.dev/response-feedback/1dccaffb-86d2-45c5-b838-fa083a0541bc?feedback_type=great_response) | [Irrelevant Answer](https://app.dosu.dev/response-feedback/1dccaffb-86d2-45c5-b838-fa083a0541bc?feedback_type=irrelevant_answer) | [Incorrect Sources](https://app.dosu.dev/response-feedback/1dccaffb-86d2-45c5-b838-fa083a0541bc?feedback_type=incorrect_sources) | [Too Verbose](https://app.dosu.dev/response-feedback/1dccaffb-86d2-45c5-b838-fa083a0541bc?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/1dccaffb-86d2-45c5-b838-fa083a0541bc?feedback_type=hallucination) | [Other](https://app.dosu.dev/response-feedback/1dccaffb-86d2-45c5-b838-fa083a0541bc?feedback_type=other)</sup>
Author
Owner
@CTD-Networks-CO-LTD commented on GitHub (Apr 13, 2025): # This is a workaround for this issue. [The "validation error" that occurred when selecting "Other file types" for the upload file has been resolved.(Dify 1.1.3 + Document Extractor and PyMuPDF Plugin) #17967](https://github.com/langgenius/dify/issues/17967#issuecomment-2800242321) @dosu
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#8019