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

When a knowledge base document is downloaded, the document content is missing #15232

Open
5 tasks done
ocyisheng opened this issue Mar 7, 2025 · 1 comment
Open
5 tasks done
Labels
🐞 bug Something isn't working

Comments

@ocyisheng
Copy link

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

dify 0.15.3 1.0.0

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

In this file,
/api/controllers/files/image_preview.py

delete the code
if upload_file.size > 0:
response.headers["Content-Length"] = str(upload_file.size)

It will work fine!!!

✔️ Expected Behavior

下载知识库库文档

❌ Actual Behavior

使用流式下载,相应头Content-Length出错

@dosubot dosubot bot added the 🐞 bug Something isn't working label Mar 7, 2025
Copy link

dosubot bot commented Mar 7, 2025

Hello @ocyisheng! I'm here to help you with any bugs, questions, or contributions you have for the project. Let's work together to solve this issue.

The issue you're encountering seems to be related to the Content-Length header in the HTTP response when downloading knowledge base documents. The user suggests that removing the code setting the Content-Length header in the image_preview.py file resolves the problem. This indicates that the Content-Length header might be causing issues with streaming downloads, possibly due to incorrect size calculations or mismatches.

To address this, you might consider verifying the calculation of upload_file.size to ensure it accurately reflects the file's size. If the size is incorrect, it could lead to incomplete downloads or errors. Alternatively, if the Content-Length header is not essential for your use case, removing it, as suggested, could be a temporary workaround. However, be cautious, as omitting this header might affect download reliability in some scenarios.

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

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
Development

No branches or pull requests

1 participant