mirror of
https://github.com/abhinavxd/libredesk.git
synced 2026-09-11 21:39:00 +00:00
d02b65f2bd
Fix a reindex race: snippet embedding runs outside the lock, so a slower job from an older edit could commit stale vectors after a newer edit. Split Reindex into embed (lock-free) and commit (locked), and gate the commit with a per-snippet generation counter so only the latest edit wins. Delete drops the counter so an in-flight job can't re-insert vectors for a deleted snippet. Clear the DB avatar reference before deleting the avatar media file. The old order deleted the file first, so a failed DB update left the DB pointing at a missing file and a broken image. Also handle unchecked errors flagged by errcheck (tx.Rollback, html.Render, fmt.Fprintf), guard capToTokens against a negative limit that would panic, and stop logging the full import URL since it can carry credentials.