fix: check header for prefix/starts with

This commit is contained in:
Derrick Hammer 2024-01-15 08:29:09 -05:00
parent 4f50d645ad
commit 592b20c561
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
1 changed files with 4 additions and 2 deletions

View File

@ -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"))