Summary
Media file retrieval in EmDash uses the media storage_key, not the media row ID.
This was not obvious during template work and led to valid-looking media URLs that returned 404 even though the media records existed.
Symptoms
- Media rows were present in the database
- URLs built from the media row ID failed with
404
- The files became accessible only when using the
storage_key value in the file path
Observed Working Pattern
The working file path format was:
/_emdash/api/media/file/<storage_key>
Why This Is A Problem
- It is easy for self-hosted theme/template developers to assume the media row ID is the correct identifier
- The failure mode looks like missing media rather than incorrect URL construction
- This slows down theme development and troubleshooting
Suggested Improvements
- Document media URL construction clearly for self-hosted template development
- Expose a helper that returns the correct served media URL directly from a media record
- If possible, make the API identifier naming more self-explanatory in docs and examples
Impact
- Causes broken media in custom templates
- Wastes debugging time because the media exists but the obvious URL guess is wrong
Summary
Media file retrieval in EmDash uses the media
storage_key, not the media row ID.This was not obvious during template work and led to valid-looking media URLs that returned
404even though the media records existed.Symptoms
404storage_keyvalue in the file pathObserved Working Pattern
The working file path format was:
/_emdash/api/media/file/<storage_key>Why This Is A Problem
Suggested Improvements
Impact