Keep technology logos and images inside text safe from pruning
Some checks failed
Tests / lint (push) Has been cancelled
Tests / test (push) Has been cancelled
Tests / test-postgres (push) Has been cancelled
Tests / mcp (push) Has been cancelled

Media::referencedPaths() is what `content:prune --media` asks before
deleting a file, and it did not know about two kinds of image a page
shows:

- A technology's logo. Every logo on the radar looked orphaned, and one
  prune would have deleted all of them.
- Images inside rich text — a page's body, a project's description,
  decisions and postmortem — whether attached in the panel's editor or
  uploaded through the API and written in as <img src>. They are now
  found in the HTML, in every language, bin included.

The page body's editor also states where attachments go — the media
disk, pages/content, public — instead of relying on Filament's
defaults: the HTML reaches the frontend as it is, and a private file
would be a broken image there.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-09-29 23:09:25 +02:00
parent 3daa40570b
commit 96747abdc3
3 changed files with 145 additions and 0 deletions

View File

@@ -75,6 +75,15 @@ class PageForm
RichEditor::make("body.{$locale}")
->label(__('panel.pages.fields.body'))
// Images in the text go where every other upload
// does, public: the HTML travels to the frontend
// as it is, with each image's URL written in, and
// a private file would be a broken image there.
// Media::referencedPaths() finds them in the body,
// so pruning never takes one a page still shows.
->fileAttachmentsDisk(config('media.disk'))
->fileAttachmentsDirectory('pages/content')
->fileAttachmentsVisibility('public')
->columnSpanFull(),
]),
]),