filamentphp/filament · error · LogicException

The visibility of file attachments for markdown content is a

Error message

The visibility of file attachments for markdown content is always `public`, since generating temporary file upload URLs is not supported in static content.

What it means

MarkdownEditor stores attachments as publicly fetchable URLs because the rendered markdown is static content — it cannot generate signed temporary URLs per request. `fileAttachmentsVisibility()` exists only to fail: it throws a LogicException on every call, while `getFileAttachmentsVisibility()` unconditionally returns `'public'`.

Source

Thrown at packages/forms/src/Components/MarkdownEditor.php:63

        ];
    }

    public function getFileAttachmentsDiskName(): string
    {
        $name = $this->evaluate($this->fileAttachmentsDiskName);

        if (filled($name)) {
            return $name;
        }

        $defaultName = config('filament.default_filesystem_disk');

        return ($defaultName === 'local') ? 'public' : $defaultName;
    }

    public function fileAttachmentsVisibility(string | Closure | null $visibility): static
    {
        throw new LogicException('The visibility of file attachments for markdown content is always `public`, since generating temporary file upload URLs is not supported in static content.');
    }

    public function getFileAttachmentsVisibility(): string
    {
        return 'public';
    }

    public function hasFileAttachmentsByDefault(): bool
    {
        return $this->hasToolbarButton('attachFiles');
    }

    public function toEmbeddedHtml(): string
    {
        $id = $this->getId();
        $isDisabled = $this->isDisabled();
        $statePath = $this->getStatePath();

View on GitHub (pinned to 53483fa934)

Solutions

  1. Remove the `fileAttachmentsVisibility()` call — markdown attachments will be public.
  2. If uploads must be private, use a `FileUpload` (which supports private visibility and signed URLs) instead of a markdown editor.
  3. Restrict access at the disk/web-server layer if markdown attachments must be protected.

Example fix

// before
MarkdownEditor::make('content')
    ->fileAttachmentsVisibility('private'),

// after
MarkdownEditor::make('content')
    ->fileAttachmentsDisk('public'),
Defensive patterns

Strategy: validation

Validate before calling

// In shared field builders, branch on editor type instead of blanket config
if ($field instanceof MarkdownEditor) {
    // Visibility is fixed to 'public' for markdown attachments — do not call
    // fileAttachmentsVisibility(); consider a FileUpload if uploads must be private.
} else {
    $field->fileAttachmentsVisibility('private');
}

Type guard

function supportsFileAttachmentsVisibility(object $field): bool
{
    return ! $field instanceof \Filament\Forms\Components\MarkdownEditor;
}

Prevention

When it happens

Trigger: Any call to `->fileAttachmentsVisibility('private')` (or any other value) on a `MarkdownEditor` field.

Common situations: Copy-pasting a FileUpload's disk/visibility config onto a markdown field, hardening an app for private uploads, or porting code that assumed the method was configurable.

Related errors


AI-assisted analysis of filamentphp/filament@53483fa934 (2026-08-17). Data as JSON: /api/errors/fa67525d930028e8. Report an issue: GitHub.