fix: enforce document ownership and make PDF uploads atomic #83

Merged
theis merged 1 commit from fix/document-ownership-and-atomic-pdf into main 2026-08-23 14:53:54 +00:00
Owner
  • Add ownership checks to document GET/PATCH/PUT/DELETE; PUT can no
    longer overwrite user_id, DELETE also removes the PDFs from the file
    store.
  • Replace delete-then-upload with an atomic swap: the new PDF is written
    fully to disk under a fresh key, then the document pointer is switched
    in one transaction and the old file deleted. A failed upload can no
    longer destroy the previously uploaded PDF (ErrPDFAlreadyExists is
    gone; uploads now replace).
  • Stop leaking raw DB errors in document handler responses; log details
    server-side instead. Speech segment loading now returns 500 instead
    of 400 on DB errors.
  • Frontend: drop the pre-delete before replace and give feedback when a
    dropped/selected file is not a PDF.
- Add ownership checks to document GET/PATCH/PUT/DELETE; PUT can no longer overwrite user_id, DELETE also removes the PDFs from the file store. - Replace delete-then-upload with an atomic swap: the new PDF is written fully to disk under a fresh key, then the document pointer is switched in one transaction and the old file deleted. A failed upload can no longer destroy the previously uploaded PDF (ErrPDFAlreadyExists is gone; uploads now replace). - Stop leaking raw DB errors in document handler responses; log details server-side instead. Speech segment loading now returns 500 instead of 400 on DB errors. - Frontend: drop the pre-delete before replace and give feedback when a dropped/selected file is not a PDF.
fix: enforce document ownership and make PDF uploads atomic
All checks were successful
/ test-frontend (push) Successful in 59s
/ test-backend (push) Successful in 2m47s
13aeff490c
- Add ownership checks to document GET/PATCH/PUT/DELETE; PUT can no
  longer overwrite user_id, DELETE also removes the PDFs from the file
  store.
- Replace delete-then-upload with an atomic swap: the new PDF is written
  fully to disk under a fresh key, then the document pointer is switched
  in one transaction and the old file deleted. A failed upload can no
  longer destroy the previously uploaded PDF (ErrPDFAlreadyExists is
  gone; uploads now replace).
- Stop leaking raw DB errors in document handler responses; log details
  server-side instead. Speech segment loading now returns 500 instead
  of 400 on DB errors.
- Frontend: drop the pre-delete before replace and give feedback when a
  dropped/selected file is not a PDF.
theis force-pushed fix/document-ownership-and-atomic-pdf from 13aeff490c
All checks were successful
/ test-frontend (push) Successful in 59s
/ test-backend (push) Successful in 2m47s
to b149a0a813
All checks were successful
/ test-frontend (push) Successful in 31s
/ test-backend (push) Successful in 1m16s
2026-08-23 14:52:23 +00:00
Compare
theis merged commit 5d83466203 into main 2026-08-23 14:53:54 +00:00
theis deleted branch fix/document-ownership-and-atomic-pdf 2026-08-23 14:53:54 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
theis/webspeaker!83
No description provided.