Skip to content

Markdown fieldtype asset picker inserts statamic://undefined (regression from #14366) #14691

@joshuap

Description

@joshuap

Bug description

Selecting an asset via the Markdown fieldtype's asset picker inserts a markdown link/image with an undefined reference:

![alt text](statamic://undefined)

Bard is not affected afaik — it uses a different code path.

How to reproduce

  1. On a fresh Statamic 6.7.2+ app, create an entry with a Markdown field that has an asset container configured.
  2. In the editor, click the asset picker icon and select any asset.
  3. Observe that the inserted markdown is ![alt](statamic://undefined) instead of ![alt](statamic://asset::container/path/to/file.ext).

Logs

No relevant logs

Environment

Laravel Version: 12.59.0
PHP Version: 8.3.31
Composer Version: 2.9.5
Environment: local
Debug Mode: ENABLED
Maintenance Mode: OFF
Timezone: UTC
Locale: en

Cache
Config: NOT CACHED
Events: NOT CACHED
Routes: NOT CACHED
Views: CACHED

Drivers
Broadcasting: log
Cache: file
Database: sqlite
Logs: stack / single
Mail: log
Queue: sync
Session: file

Storage
public/storage: NOT LINKED

Statamic
Addons: 3
License Key: Set
Sites: 1
Stache Watcher: Enabled
Static Caching: Disabled
Version: 6.19.0 PRO

Statamic Addons
doefom/statamic-export: 0.7.0
honeybadger/revision-diff: dev-joshuap/post-diff
statamic/seo-pro: 7.9.0

Installation

Fresh statamic/statamic site via CLI

Additional details

Here's the root cause according to Claude:

PR #14366 (Statamic 6.7.2, merged 2026-03-27) replaced the resource returned by POST /cp/assets-fieldtype from Statamic\Http\Resources\CP\Assets\Asset with the slimmer
Statamic\Http\Resources\CP\Assets\AssetsFieldtypeAsset. The new resource omits the reference key:

https://github.com/statamic/cms/blob/6.x/src/Http/Resources/CP/Assets/AssetsFieldtypeAsset.php

But the Markdown fieldtype still reads asset.reference when an asset is selected:

https://github.com/statamic/cms/blob/6.x/resources/js/components/fieldtypes/markdown/MarkdownFieldtype.vue#L585

const url = encodeURI(`statamic://${asset.reference}`);

asset.reference is undefined, so the inserted URL is the literal string statamic://undefined.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions