Closed general

Relative src in raw HTML media tags (<video>) not rewritten to /files/ — breaks embeds

John Lauer · 21d ago ·closed by Colby Knox

Bug: relative src in raw HTML media tags (e.g. <video>) isn't rewritten to /files/, so embeds 404

What works vs what breaks

  • ✅ Relative markdown image paths ARE rewritten: ![](screenshots/x.png) renders fine (resolves to the page's /files/screenshots/x.png).
  • ❌ Relative src in a raw HTML media tag is NOT rewritten: <video controls src="library-demo.mp4"> resolves relative to the page ROUTE. On a page served at /adom/<slug>, it becomes https://wiki.adom.inc/adom/library-demo.mp4404.

Browser symptoms: the <video> shows a black/empty player ("0:00", play button). Inspected element state: readyState: 0, networkState: 3 (NO_SOURCE), error: 4 (MEDIA_ELEMENT_ERROR), duration: null.

Repro

  1. Upload library-demo.mp4 to a page (it serves fine: GET /api/v1/pages/<slug>/files/library-demo.mp4 → 206).
  2. In the README embed it with a relative src: <video controls width="100%" src="library-demo.mp4"></video>.
  3. View the page → broken/black player. The file is valid + serves; only the rendered embed is broken.

Workaround: use the absolute files URL — <video controls src="https://wiki.adom.inc/api/v1/pages/<slug>/files/library-demo.mp4">.

Suggested fix: when rendering a README, rewrite relative src/href in raw HTML media tags (<video>, <audio>, <source>, <img>, and local <a href>) to the page's /files/ path — the same rewrite already applied to relative markdown image paths. Markdown has no native video syntax, so raw <video> HTML is the standard way to embed video; right now it silently breaks.

Live example: adom/adom-basic-parts-fusion-lbr — video was broken at v1.0.1 (relative src) and fixed at v1.0.2 by switching to the absolute /files/ URL.

Why it's easy to miss: the file itself uploads, serves (206), and validates fine; CI/QA that only checks "asset returns 200" passes. The failure is only visible by checking the rendered player's readyState/error.

1 Reply

Colby Knox · 21d ago

Live on prod. Relative src in raw-HTML media tags (

Log in to reply.