Attachment from pages in the bin are still listed in the API #6194

Open
opened 2026-08-24 15:56:40 +02:00 by matthias4217 · 0 comments

Describe the Bug

When using /api/attachments/, I have noticed some uploaded_to ids link to missing pages. A request to /api/pages/{uploaded_to} give a 404 HTTP error code. I assume these pages have been deleted, but are still in the bin, awaiting their eventual complete deletion.

Steps to Reproduce

  1. Create a new page
  2. Upload an attachment
  3. Check /api/attachments/{id} and /api/pages/{id from attachment uploaded_to}. They should both give correct results.
  4. Delete the page
  5. Check /api/attachments/{id} and /api/pages/{id from attachment uploaded_to}. The attachment call should be unchanged, but the pages one will give a 404 error.

Expected Behaviour

Given that the ID of a deleted page doesn’t have a usable meaning, I would expect either to see a 404 for the attachment (ideally, as the attachment become unusable from the web interface anyway), or a null value.

Screenshots or Additional Context

See the original message here : https://community.bookstackapp.com/#narrow/channel/4-help-and-support/topic/Attachment.27s.20parent.20page.20could.20not.20be.20found/with/1470

We use a slighty modified Bookstack version, with a couple of small cosmetic changes. The API has not been modified.

Browser Details

No response

Exact BookStack Version

v26.03.4

### Describe the Bug When using `/api/attachments/`, I have noticed some `uploaded_to` ids link to missing pages. A request to `/api/pages/{uploaded_to}` give a 404 HTTP error code. I assume these pages have been deleted, but are still in the bin, awaiting their eventual complete deletion. ### Steps to Reproduce 1. Create a new page 2. Upload an attachment 3. Check `/api/attachments/{id}` and `/api/pages/{id from attachment uploaded_to}`. They should both give correct results. 4. Delete the page 5. Check `/api/attachments/{id}` and `/api/pages/{id from attachment uploaded_to}`. The attachment call should be unchanged, but the pages one will give a 404 error. ### Expected Behaviour Given that the ID of a deleted page doesn’t have a usable meaning, I would expect either to see a 404 for the attachment (ideally, as the attachment become unusable from the web interface anyway), or a null value. ### Screenshots or Additional Context See the original message here : https://community.bookstackapp.com/#narrow/channel/4-help-and-support/topic/Attachment.27s.20parent.20page.20could.20not.20be.20found/with/1470 We use a slighty modified Bookstack version, with a couple of small cosmetic changes. The API has not been modified. ### Browser Details _No response_ ### Exact BookStack Version v26.03.4
Sign in to join this conversation.
No milestone
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
bookstack/bookstack#6194
No description provided.