Files
outline/plugins/storage
fedbf28a6a fix(storage): destroy attachment row on failed upload in files.create (#13914)
* fix(storage): destroy attachment row on failed upload in files.create

Three throwing paths in files.create (auth failure, size validation,
writeFile error) left the pre-created Attachment row in the database.
The @BeforeDestroy hook already handles storage cleanup safely, so call
attachment.destroy() before throwing in each of those branches.

Fixes #13824

* Potential fix for pull request finding 'Prevent unauthorized deletion of another user's attachment'

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: Tom Moor <tom.moor@gmail.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
2026-10-05 21:56:04 -04:00
..