Rewrite URLs of images in generator descriptions

to honor the static_url
This commit is contained in:
Florian Festi 2023-01-03 11:09:44 +01:00
parent 6aa5cb4204
commit 5503f06e31
1 changed files with 3 additions and 2 deletions

View File

@ -290,8 +290,9 @@ class BServer:
no_img_msg = _('There is no image yet. Please donate an image of your project on <a href=&quot;https://github.com/florianfesti/boxes/issues/140&quot;>GitHub</a>!')
if box.description:
result.append(markdown.markdown(_(box.description),
extensions=["extra"]))
result.append(
markdown.markdown(_(box.description), extensions=["extra"])
.replace('src="static/', f'src="{static_url}/'))
result.append(f'''<div>
<img src="{static_url}/samples/{box.__class__.__name__}.jpg" width="100%" onerror="this.parentElement.innerHTML = '{no_img_msg}';">