Skip to content

Commit 922d252

Browse files
authored
Custom Error Pages: Accept first of many MIME types. (#13005)
1 parent 9b74afd commit 922d252

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)