Fix f-string syntax error in IPFS display

Build ipfs_html separately to avoid nested f-string issues.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
gilesb
2026-01-08 19:18:41 +00:00
parent 8ae354d503
commit fd239d99f9

View File

@@ -810,6 +810,18 @@ async def ui_asset_detail(name: str, request: Request):
if tags:
tags_html = " ".join([f'<span class="px-2 py-1 bg-dark-500 text-gray-300 text-xs rounded">{t}</span>' for t in tags])
# IPFS display
if ipfs_cid:
local_gateway = f'<a href="{IPFS_GATEWAY_URL}/ipfs/{ipfs_cid}" target="_blank" class="px-2 py-1 bg-green-600 hover:bg-green-700 text-white text-xs rounded">Local</a>' if IPFS_GATEWAY_URL else ''
ipfs_html = f'''<code class="text-purple-300 text-sm break-all mb-2 block">{ipfs_cid}</code>
<div class="flex flex-wrap gap-1 mt-2">
{local_gateway}
<a href="https://ipfs.io/ipfs/{ipfs_cid}" target="_blank" class="px-2 py-1 bg-purple-600 hover:bg-purple-700 text-white text-xs rounded">ipfs.io</a>
<a href="https://dweb.link/ipfs/{ipfs_cid}" target="_blank" class="px-2 py-1 bg-purple-600 hover:bg-purple-700 text-white text-xs rounded">dweb.link</a>
</div>'''
else:
ipfs_html = '<span class="text-gray-500">Not on IPFS</span>'
# Provenance section - for rendered outputs
provenance_html = ""
if provenance:
@@ -940,12 +952,7 @@ async def ui_asset_detail(name: str, request: Request):
<div class="bg-dark-600 rounded-lg p-4">
<h3 class="text-sm font-medium text-gray-400 mb-2">IPFS</h3>
{f'''<code class="text-purple-300 text-sm break-all mb-2 block">{ipfs_cid}</code>
<div class="flex flex-wrap gap-1 mt-2">
{f'<a href="{IPFS_GATEWAY_URL}/ipfs/{ipfs_cid}" target="_blank" class="px-2 py-1 bg-green-600 hover:bg-green-700 text-white text-xs rounded">Local</a>' if IPFS_GATEWAY_URL else ''}
<a href="https://ipfs.io/ipfs/{ipfs_cid}" target="_blank" class="px-2 py-1 bg-purple-600 hover:bg-purple-700 text-white text-xs rounded">ipfs.io</a>
<a href="https://dweb.link/ipfs/{ipfs_cid}" target="_blank" class="px-2 py-1 bg-purple-600 hover:bg-purple-700 text-white text-xs rounded">dweb.link</a>
</div>''' if ipfs_cid else '<span class="text-gray-500">Not on IPFS</span>'}
{ipfs_html}
</div>
<div class="bg-dark-600 rounded-lg p-4">