{"record":{"id":"fa67525d930028e8","repo":"filamentphp/filament","slug":"the-visibility-of-file-attachments-for-markdown-co","errorCode":null,"errorMessage":"The visibility of file attachments for markdown content is always `public`, since generating temporary file upload URLs is not supported in static content.","messagePattern":"The visibility of file attachments for markdown content is always `public`, since generating temporary file upload URLs is not supported in static content\\.","errorType":"exception","errorClass":"LogicException","httpStatus":null,"severity":"error","filePath":"packages/forms/src/Components/MarkdownEditor.php","lineNumber":63,"sourceCode":"        ];\n    }\n\n    public function getFileAttachmentsDiskName(): string\n    {\n        $name = $this->evaluate($this->fileAttachmentsDiskName);\n\n        if (filled($name)) {\n            return $name;\n        }\n\n        $defaultName = config('filament.default_filesystem_disk');\n\n        return ($defaultName === 'local') ? 'public' : $defaultName;\n    }\n\n    public function fileAttachmentsVisibility(string | Closure | null $visibility): static\n    {\n        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.');\n    }\n\n    public function getFileAttachmentsVisibility(): string\n    {\n        return 'public';\n    }\n\n    public function hasFileAttachmentsByDefault(): bool\n    {\n        return $this->hasToolbarButton('attachFiles');\n    }\n\n    public function toEmbeddedHtml(): string\n    {\n        $id = $this->getId();\n        $isDisabled = $this->isDisabled();\n        $statePath = $this->getStatePath();\n","sourceCodeStart":45,"sourceCodeEnd":81,"githubUrl":"https://github.com/filamentphp/filament/blob/53483fa9340e4ec637985fe454ebb58afb92ea24/packages/forms/src/Components/MarkdownEditor.php#L45-L81","documentation":"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'`.","triggerScenarios":"Any call to `->fileAttachmentsVisibility('private')` (or any other value) on a `MarkdownEditor` field.","commonSituations":"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.","solutions":["Remove the `fileAttachmentsVisibility()` call — markdown attachments will be public.","If uploads must be private, use a `FileUpload` (which supports private visibility and signed URLs) instead of a markdown editor.","Restrict access at the disk/web-server layer if markdown attachments must be protected."],"exampleFix":"// before\nMarkdownEditor::make('content')\n    ->fileAttachmentsVisibility('private'),\n\n// after\nMarkdownEditor::make('content')\n    ->fileAttachmentsDisk('public'),","handlingStrategy":"validation","validationCode":"// In shared field builders, branch on editor type instead of blanket config\nif ($field instanceof MarkdownEditor) {\n    // Visibility is fixed to 'public' for markdown attachments — do not call\n    // fileAttachmentsVisibility(); consider a FileUpload if uploads must be private.\n} else {\n    $field->fileAttachmentsVisibility('private');\n}","typeGuard":"function supportsFileAttachmentsVisibility(object $field): bool\n{\n    return ! $field instanceof \\Filament\\Forms\\Components\\MarkdownEditor;\n}","tryCatchPattern":null,"preventionTips":["Assume markdown attachments are public by design; plan disk policy accordingly.","Keep per-component config arrays instead of applying the same chain to every field.","For private uploads, model the attribute with FileUpload, not MarkdownEditor."],"tags":["filament","markdown-editor","file-uploads","visibility","unsupported-method"],"backgroundTag":"unsupported-configuration-method","analyzedSha":"53483fa9340e4ec637985fe454ebb58afb92ea24","analyzedAt":"2026-08-17T02:06:23.049Z","schemaVersion":2},"datasetVersion":"2026-08-17T04:17:16.089Z"}