diff --git a/internal/httpServer.go b/internal/httpServer.go index 8643e13..33d9ca3 100644 --- a/internal/httpServer.go +++ b/internal/httpServer.go @@ -75,13 +75,13 @@ func httpGetFile(rw http.ResponseWriter, r *http.Request, s3Client *minio.Client func httpPostFile(rw http.ResponseWriter, r *http.Request, s3Client *minio.Client) { - contentType := r.Header.Get("Content-Type") - mimeType, err, _ := mime.ParseMediaType(contentType) - if mimeType != "multipart/form-data" || err != nil { - rw.WriteHeader(400) - return - } + filename := r.URL.Query().Get("id") - r.ParseMultipartForm(10 << 20) + contentType := r.Header.Get("Content-Type") + mimeType, _, _ := mime.ParseMediaType(contentType) + + s3Client.PutObject(context.Background(), bucketName, filename, r.Body, r.ContentLength, minio.PutObjectOptions{ + ContentType: mimeType, + }) }