Skip to content

Commit f051ca3

Browse files
Custom Error Pages: Accept first of many MIME types. (#13006)
Co-authored-by: Jeremy Ebler <[email protected]>
1 parent 4b34d13 commit f051ca3

File tree

1 file changed

+6
-0
lines changed
  • images/custom-error-pages/rootfs

1 file changed

+6
-0
lines changed

images/custom-error-pages/rootfs/main.go

+6
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,12 @@ func errorHandler(path, defaultFormat string) func(http.ResponseWriter, *http.Re
126126
log.Printf("format not specified. Using %v", format)
127127
}
128128

129+
// if multiple formats are provided, use the first one
130+
index := strings.Index(format, ",")
131+
if index != -1 {
132+
format = format[:index]
133+
}
134+
129135
cext, err := mime.ExtensionsByType(format)
130136
if err != nil {
131137
log.Printf("unexpected error reading media type extension: %v. Using %v", err, ext)

0 commit comments

Comments
 (0)