Custom Error Pages: Accept first of many MIME types. (#13005)
This commit is contained in:
parent
9b74afd990
commit
922d2520f1
|
|
@ -126,6 +126,12 @@ func errorHandler(path, defaultFormat string) func(http.ResponseWriter, *http.Re
|
|||
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)
|
||||
if err != nil {
|
||||
log.Printf("unexpected error reading media type extension: %v. Using %v", err, ext)
|
||||
|
|
|
|||
Loading…
Reference in New Issue