Render images in file browser blob view

Add /repo/{name}/raw/{hash}/** endpoint serving binary file content
with correct Content-Type. Blob view detects image extensions (png,
jpg, gif, bmp, webp, svg, ico) and renders an <img> tag instead of
a <pre> text block.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
2026-02-27 10:17:30 +01:00
parent b0c869829f
commit d68933bc2f
5 changed files with 103 additions and 3 deletions
+4 -1
View File
@@ -25,7 +25,10 @@
</table>
<h3>Content</h3>
<pre th:text="${content}">File content here</pre>
<div th:if="${isImage}">
<img th:src="@{/repo/{name}/raw/{hash}/{filePath}(name=${name}, hash=${hash}, filePath=${filePath})}" alt="" border="0">
</div>
<pre th:unless="${isImage}" th:text="${content}">File content here</pre>
</body>
</html>