Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HTTP Request Node Not Retrieve File Extension from Content-Disposition Header #12608

Open
5 tasks done
EcoleKeine opened this issue Jan 10, 2025 · 3 comments · May be fixed by #12653
Open
5 tasks done

HTTP Request Node Not Retrieve File Extension from Content-Disposition Header #12608

EcoleKeine opened this issue Jan 10, 2025 · 3 comments · May be fixed by #12653
Labels
🐞 bug Something isn't working

Comments

@EcoleKeine
Copy link

EcoleKeine commented Jan 10, 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

0.15.0

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

  1. "http-request" download docx file
  2. "doc extractor" node

✔️ Expected Behavior

HTTP Request Node download the .docx file

❌ Actual Behavior

"doc extractor" node error: Unsupported Extension Type: .bin

Http request output:

{
  "status_code": 200,
  "body": "",
  "headers": {
    "server": "openresty",
    "date": "Fri, 10 Jan 2025 08:24:28 GMT",
    "content-type": "application/octet-stream; charset=UTF-8",
    "content-length": "19121",
    "connection": "keep-alive",
    "accept-ranges": "bytes",
    "etag": "64ba7c8713b64b689feeb4cc2b1f4954",
    "content-disposition": "attachment; filename=\"%e4******%95.docx\"; charset=UTF-8"
  },
  "files": [
    {
      "dify_model_identity": "__dify__file__",
      "id": null,
      "tenant_id": "3e581dc4-d40f-412b-b1de-dcc39fa288b4",
      "type": "custom",
      "transfer_method": "tool_file",
      "remote_url": null,
      "related_id": "1c9dd6a3-d0e2-4fd6-b899-222fc34eb366",
      "filename": "32b96deebef6444bad37bab894fb5d37.bin",
      "extension": ".bin",
      "mime_type": "application/octet-stream; charset=UTF-8",
      "size": 19121,
      "url": "/files/tools/1c9dd6a3-d0e2-4fd6-b899-222fc34eb366.bin?timestamp=1736497468&nonce=d2a5bb1c5141ab6b91ae877a8550d894&sign=5b7SpNwVHSfBruJ8zJc8AuGMAqOiCZfMRgWf0EnHuRg="
    }
  ]
}

"doc extractor" data handle :

{
  "documents": [
    {
      "dify_model_identity": "__dify__file__",
      "id": null,
      "tenant_id": "3e581dc4-d40f-412b-b1de-dcc39fa288b4",
      "type": "custom",
      "transfer_method": "tool_file",
      "remote_url": null,
      "related_id": "1c9dd6a3-d0e2-4fd6-b899-222fc34eb366",
      "filename": "32b96deebef6444bad37bab894fb5d37.bin",
      "extension": ".bin",
      "mime_type": "application/octet-stream; charset=UTF-8",
      "size": 19121,
      "url": "/files/tools/1c9dd6a3-d0e2-4fd6-b899-222fc34eb366.bin?timestamp=1736497468&nonce=e4c5844225ee8e0b11424aaaad307e1c&sign=ZkMjOv1-A9YpkQ3iBSn2Yu8ANZO9AbMarklwQh9IasU="
    }
  ]
}
Copy link

dosubot bot commented Jan 10, 2025

The "Unsupported Extension Type: .bin" error occurs because the "doc extractor" node does not support the .bin extension. The file downloaded by the "Http-request" node is being saved with a .bin extension due to its MIME type being application/octet-stream, which is a generic binary type.

To resolve this issue, you can modify the process to correctly identify the file type and extension. Here are some steps you can take:

  1. Check the Content-Disposition Header: The Content-Disposition header in your response includes a filename with a .docx extension. Use this filename to set the correct extension for the file.

  2. Modify the File Handling Logic: Ensure that the logic in the "Http-request" node or subsequent processing steps correctly assigns the .docx extension to the file based on the Content-Disposition header.

  3. Update the File Information: Before passing the file to the "doc extractor" node, update the file's metadata to reflect the correct extension and MIME type.

By ensuring the file is correctly identified as a .docx file, the "doc extractor" node should be able to process it without errors, as .docx is a supported extension [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 dosubot bot added the 🐞 bug Something isn't working label Jan 10, 2025
@halogen22
Copy link
Contributor

I will work on this issue.
Please assign, if it is possible

@kurokobo
Copy link
Contributor

#12644 (comment)

@EcoleKeine EcoleKeine changed the title "Doc extractor" node can not handle file download by "Http-request" node: "Unsupported Extension Type: .bin" HTTP Request Node Not Retrieve File Extension from Content-Disposition Header Jan 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐞 bug Something isn't working
Projects
None yet
3 participants