forked from jriou/coller
fix: Upload text files other than plain text
Fixes #23 Signed-off-by: Julien Riou <julien@riou.xyz>
This commit is contained in:
parent
af5baa999c
commit
401397241b
1 changed files with 1 additions and 1 deletions
|
@ -246,7 +246,7 @@ func (h *CreateNoteWithFormHandler) ServeHTTP(w http.ResponseWriter, r *http.Req
|
||||||
}
|
}
|
||||||
|
|
||||||
h.logger.Debug("checking file content type")
|
h.logger.Debug("checking file content type")
|
||||||
if handler.Header.Get("Content-Type") != "text/plain" {
|
if !strings.HasPrefix(handler.Header.Get("Content-Type"), "text/") {
|
||||||
h.PageData.Err = fmt.Errorf("text file expected (got %s)", handler.Header.Get("Content-Type"))
|
h.PageData.Err = fmt.Errorf("text file expected (got %s)", handler.Header.Get("Content-Type"))
|
||||||
h.Templates.ExecuteTemplate(w, templateName, h.PageData)
|
h.Templates.ExecuteTemplate(w, templateName, h.PageData)
|
||||||
return
|
return
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue