Skip to content

Bug / Documentation Gap: Media file URLs are non-obvious for template developers #279

Description

@omgitsgela

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

  1. Document media URL construction clearly for self-hosted template development
  2. Expose a helper that returns the correct served media URL directly from a media record
  3. 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

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