fix: check header for prefix/starts with
This commit is contained in:
parent
4f50d645ad
commit
592b20c561
|
@ -11,6 +11,7 @@ import (
|
||||||
"io"
|
"io"
|
||||||
"mime/multipart"
|
"mime/multipart"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
@ -41,8 +42,9 @@ func (h *HttpHandlerImpl) SmallFileUpload(jc *jape.Context) {
|
||||||
buffer := bytes.NewBuffer(nil)
|
buffer := bytes.NewBuffer(nil)
|
||||||
|
|
||||||
r := jc.Request
|
r := jc.Request
|
||||||
// Check if the content type is multipart/form-data
|
contentType := r.Header.Get("Content-Type")
|
||||||
if r.Header.Get("Content-Type") == "multipart/form-data" {
|
|
||||||
|
if strings.HasPrefix(contentType, "multipart/form-data") {
|
||||||
// Parse the multipart form
|
// Parse the multipart form
|
||||||
err := r.ParseMultipartForm(h.portal.Config().GetInt64("core.post-upload-limit"))
|
err := r.ParseMultipartForm(h.portal.Config().GetInt64("core.post-upload-limit"))
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue