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

Image file not deleted when a doc is removed #9541

Closed
5 tasks done
wy96f opened this issue Oct 21, 2024 · 3 comments · Fixed by #10465
Closed
5 tasks done

Image file not deleted when a doc is removed #9541

wy96f opened this issue Oct 21, 2024 · 3 comments · Fixed by #10465
Labels
🐞 bug Something isn't working

Comments

@wy96f
Copy link
Contributor

wy96f commented Oct 21, 2024

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

Cloud or Self Hosted

Self Hosted (Source)

Steps to reproduce

  1. add a docx file containing images in a knowledgebase
  2. remove the above file
  3. view the folder "image_files" and "upload_files"

✔️ Expected Behavior

Image files in the docx file should be deleted

❌ Actual Behavior

Image files in the docx file not deleted

@dosubot dosubot bot added the 🐞 bug Something isn't working label Oct 21, 2024
Copy link

dosubot bot commented Oct 21, 2024

The issue you're experiencing, where image files are not deleted when a document is removed, might be related to the cleanup process not being triggered or executed correctly. The function responsible for cleaning up associated files when a document is deleted is clean_notion_document_task. This function is supposed to handle the removal of document segments from the database and delete associated files from storage [1][2][3].

Here are a few things you might want to check or try:

  1. Ensure Event Triggering: Verify that the document_was_deleted event is being triggered correctly when you delete a document. This event should initiate the cleanup process.

  2. Check for Errors: Look for any error logs or exceptions that might be occurring during the deletion process. The code includes exception handling that logs errors if the cleanup fails [4].

  3. Review Configuration: Although I couldn't find specific configuration settings or flags that control the deletion of image files, ensure that your setup is correctly configured to allow file deletions.

If these steps don't resolve the issue, it might require a deeper investigation into the code or configuration of your Dify instance.

To continue talking to Dosu, mention @dosu.

@crazywoola
Copy link
Member

You need to run clean_notion_document_task to clean up things there. If you are using source code, please make sure you ran this command mannually.

@wy96f
Copy link
Contributor Author

wy96f commented Oct 21, 2024

@crazywoola We're uploading documents from local disk instead of Notion. When deleting a doc in the web, the doc in "uplaod_files" folder is deleted, but image files extrating from the doc remains in "image_files" folder. Please reopen this issue.

liuhaoran1212 pushed a commit to liuhaoran1212/dify that referenced this issue Nov 8, 2024
laipz8200 pushed a commit that referenced this issue Nov 11, 2024
AlwaysBluer pushed a commit to AlwaysBluer/dify that referenced this issue Nov 14, 2024
laipz8200 pushed a commit that referenced this issue Nov 21, 2024
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

Successfully merging a pull request may close this issue.

2 participants