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:
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user