Commit 4e02ae9d authored by Matt Bell's avatar Matt Bell Committed by Juan Batiz-Benet

commands/http: Respond with error if encoding option isn't a string

parent a14ee931
......@@ -43,7 +43,12 @@ func (i Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "application/octet-stream")
} else {
enc, _ := req.Option(cmds.EncShort)
mime := mimeTypes[enc.(string)]
encStr, ok := enc.(string)
if !ok {
w.WriteHeader(http.StatusInternalServerError)
return
}
mime := mimeTypes[encStr]
w.Header().Set("Content-Type", mime)
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment