Skip to content

fix(file): delete physical cache files when removing documents#807

Open
majiayu000 wants to merge 1 commit intoCinnamon:mainfrom
majiayu000:fix/delete-physical-files-on-document-removal
Open

fix(file): delete physical cache files when removing documents#807
majiayu000 wants to merge 1 commit intoCinnamon:mainfrom
majiayu000:fix/delete-physical-files-on-document-removal

Conversation

@majiayu000
Copy link

Summary

  • Add _delete_physical_files method to clean up cache files on document deletion
  • Delete chunk cache files from KH_CHUNKS_OUTPUT_DIR
  • Delete markdown cache files from KH_MARKDOWN_OUTPUT_DIR
  • Graceful error handling to prevent deletion failures from blocking the operation

Test plan

  • Added unit tests for cache file deletion scenarios
  • Tests cover: file deletion, directory deletion, empty filename, missing dirs

Fixes #717

Fixes Cinnamon#717

When deleting documents via the UI, the deletion now also removes:
- Chunk cache files from KH_CHUNKS_OUTPUT_DIR
- Markdown cache files from KH_MARKDOWN_OUTPUT_DIR

This prevents storage bloat from orphaned cache files that were
previously left behind after document deletion.

Signed-off-by: majiayu000 <1835304752@qq.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Physical Files Not Deleted When Removing Documents via UI

1 participant