Custom Error Pages: Accept first of many MIME types. (#13006)
Co-authored-by: Jeremy Ebler <jebler@gmail.com>
This commit is contained in:
parent
4b34d134a6
commit
f051ca3b3f
1 changed files with 6 additions and 0 deletions
|
@ -126,6 +126,12 @@ func errorHandler(path, defaultFormat string) func(http.ResponseWriter, *http.Re
|
||||||
log.Printf("format not specified. Using %v", format)
|
log.Printf("format not specified. Using %v", format)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// if multiple formats are provided, use the first one
|
||||||
|
index := strings.Index(format, ",")
|
||||||
|
if index != -1 {
|
||||||
|
format = format[:index]
|
||||||
|
}
|
||||||
|
|
||||||
cext, err := mime.ExtensionsByType(format)
|
cext, err := mime.ExtensionsByType(format)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Printf("unexpected error reading media type extension: %v. Using %v", err, ext)
|
log.Printf("unexpected error reading media type extension: %v. Using %v", err, ext)
|
||||||
|
|
Loading…
Reference in a new issue