Fix embedded media to use /raw endpoint

After L1 content negotiation fix, /cache/{hash} returns HTML for
browsers. Embedded <img> tags need /raw to get actual image data.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
gilesb
2026-01-09 12:24:18 +00:00
parent 00820b09cf
commit b810a65f5b

View File

@@ -594,10 +594,10 @@ async def ui_activity_detail(activity_index: int, request: Request):
elif "Image" in obj_type or "image" in media_type:
content_html = f'''
<div class="bg-dark-600 rounded-lg p-4 mb-6">
<img src="{l1_server}/cache/{content_hash}" alt="{obj_name}"
<img src="{l1_server}/cache/{content_hash}/raw" alt="{obj_name}"
class="max-w-full max-h-96 mx-auto rounded-lg">
<div class="mt-3 text-center">
<a href="{l1_server}/cache/{content_hash}" download
<a href="{l1_server}/cache/{content_hash}/raw" download
class="inline-block px-4 py-2 bg-green-600 hover:bg-green-700 text-white font-medium rounded-lg transition-colors">
Download
</a>
@@ -657,7 +657,7 @@ async def ui_activity_detail(activity_index: int, request: Request):
class="max-h-40 rounded hidden" muted loop playsinline
onloadeddata="this.classList.remove('hidden'); this.nextElementSibling.classList.add('hidden'); this.play();">
</video>
<img src="{l1_server}/cache/{inp_hash}" alt="Input"
<img src="{l1_server}/cache/{inp_hash}/raw" alt="Input"
class="max-h-40 rounded">
</div>
<div class="text-center">
@@ -830,10 +830,10 @@ async def ui_asset_detail(name: str, request: Request):
elif asset_type == "image":
content_html = f'''
<div class="bg-dark-600 rounded-lg p-4 mb-6">
<img src="{l1_server}/cache/{content_hash}" alt="{name}"
<img src="{l1_server}/cache/{content_hash}/raw" alt="{name}"
class="max-w-full max-h-96 mx-auto rounded-lg">
<div class="mt-3 text-center">
<a href="{l1_server}/cache/{content_hash}" download
<a href="{l1_server}/cache/{content_hash}/raw" download
class="inline-block px-4 py-2 bg-green-600 hover:bg-green-700 text-white font-medium rounded-lg transition-colors">
Download
</a>
@@ -947,7 +947,7 @@ async def ui_asset_detail(name: str, request: Request):
class="max-h-40 rounded hidden" muted loop playsinline
onloadeddata="this.classList.remove('hidden'); this.nextElementSibling.classList.add('hidden'); this.play();">
</video>
<img src="{l1_server}/cache/{inp_hash}" alt="Input"
<img src="{l1_server}/cache/{inp_hash}/raw" alt="Input"
class="max-h-40 rounded">
</div>
<div class="text-center">