Bug
When an image field (type image) is stored in a content entry, the MediaValue object has the media reference ID in the src field instead of a resolved URL:
{
"provider": "local",
"id": "",
"src": "01KPD97MWB5DVHBHK69TW55KY3"
}
Expected
Either:
id should contain the media reference ID and src should be empty/undefined (or a resolved URL)
- Or
src should contain a usable URL like /_emdash/api/media/file/01KPD97MWB5DVHBHK69TW55KY3
Actual
id is an empty string ""
src contains the bare ULID "01KPD97MWB5DVHBHK69TW55KY3" (not a URL)
Impact
Any code that reads MediaValue.src and treats it as a URL (which is reasonable given the field name) will output the bare ID. This affects:
- Schema/JSON-LD —
BlogPosting.image gets the bare ID instead of a URL, breaking Google rich results validation
- og:image meta tags — same issue, social cards show broken images
- Any template that manually reads
entry.data.hero_image.src expecting a URL
Workaround
We currently detect bare IDs in src and manually resolve them:
if (img?.src) {
if (img.src.startsWith("http")) return img.src;
if (img.src.startsWith("/")) return `${origin}${img.src}`;
return `${origin}/_emdash/api/media/file/${img.src}`;
}
Environment
- EmDash 0.4.x
- Astro 6 + Cloudflare Workers
- Content created through EmDash admin UI (not imported)
Notes
The EmDashImage component handles this correctly internally via buildLocalImageUrl() which falls back from meta.storageKey to id. But external consumers of MediaValue (like schema generation or og:image) don't have that logic and reasonably expect src to be a URL.
Bug
When an image field (type
image) is stored in a content entry, theMediaValueobject has the media reference ID in thesrcfield instead of a resolved URL:{ "provider": "local", "id": "", "src": "01KPD97MWB5DVHBHK69TW55KY3" }Expected
Either:
idshould contain the media reference ID andsrcshould be empty/undefined (or a resolved URL)srcshould contain a usable URL like/_emdash/api/media/file/01KPD97MWB5DVHBHK69TW55KY3Actual
idis an empty string""srccontains the bare ULID"01KPD97MWB5DVHBHK69TW55KY3"(not a URL)Impact
Any code that reads
MediaValue.srcand treats it as a URL (which is reasonable given the field name) will output the bare ID. This affects:BlogPosting.imagegets the bare ID instead of a URL, breaking Google rich results validationentry.data.hero_image.srcexpecting a URLWorkaround
We currently detect bare IDs in
srcand manually resolve them:Environment
Notes
The
EmDashImagecomponent handles this correctly internally viabuildLocalImageUrl()which falls back frommeta.storageKeytoid. But external consumers ofMediaValue(like schema generation or og:image) don't have that logic and reasonably expectsrcto be a URL.