Skip to content

Commit 5d8b45c

Browse files
committed
fileserver: Escape # and ? in img src (fix #6237)
1 parent 0b381eb commit 5d8b45c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

modules/caddyhttp/fileserver/browse.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
</svg>
2222
{{- else if .HasExt ".jpg" ".jpeg" ".png" ".gif" ".webp" ".tiff" ".bmp" ".heif" ".heic" ".svg"}}
2323
{{- if eq .Tpl.Layout "grid"}}
24-
<img loading="lazy" src="{{html .Name}}">
24+
<img loading="lazy" src="{{.Name | replace "#" "%23" | replace "?" "%3f" | html}}">
2525
{{- else}}
2626
<svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-photo" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
2727
<path stroke="none" d="M0 0h24v24H0z" fill="none"/>

0 commit comments

Comments
 (0)