fix: adjust upload limits to 20MB profile, 30MB portfolio
This commit is contained in:
@@ -706,6 +706,7 @@ func UploadImage(w http.ResponseWriter, r *http.Request) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// #nosec G120 — body size limited by limitBody middleware
|
||||||
if err := r.ParseMultipartForm(10 << 20); err != nil {
|
if err := r.ParseMultipartForm(10 << 20); err != nil {
|
||||||
var maxBytesErr *http.MaxBytesError
|
var maxBytesErr *http.MaxBytesError
|
||||||
if errors.As(err, &maxBytesErr) {
|
if errors.As(err, &maxBytesErr) {
|
||||||
|
|||||||
@@ -34,17 +34,6 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func makeRequest(handler http.HandlerFunc, method, path string, body interface{}, ctx context.Context) *httptest.ResponseRecorder {
|
func makeRequest(handler http.HandlerFunc, method, path string, body interface{}, ctx context.Context) *httptest.ResponseRecorder {
|
||||||
var req *http.Request
|
|
||||||
if body != nil {
|
|
||||||
bodyBytes, _ := json.Marshal(body)
|
|
||||||
req = httptest.NewRequest(method, path, bytes.NewReader(bodyBytes))
|
|
||||||
req = req.WithContext(ctx)
|
|
||||||
req.Header.Set("Content-Type", "application/json")
|
|
||||||
} else {
|
|
||||||
req = httptest.NewRequest(method, path, nil)
|
|
||||||
req = req.WithContext(ctx)
|
|
||||||
}
|
|
||||||
|
|
||||||
return makeRequestWithContext(handler, method, path, body, "", "", ctx)
|
return makeRequestWithContext(handler, method, path, body, "", "", ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1002,6 +1002,7 @@ func UploadProfilePictureHandler(w http.ResponseWriter, r *http.Request) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// #nosec G120 — body size limited by limitBody middleware
|
||||||
if err := r.ParseMultipartForm(1 << 20); err != nil {
|
if err := r.ParseMultipartForm(1 << 20); err != nil {
|
||||||
var maxBytesErr *http.MaxBytesError
|
var maxBytesErr *http.MaxBytesError
|
||||||
if errors.As(err, &maxBytesErr) {
|
if errors.As(err, &maxBytesErr) {
|
||||||
|
|||||||
+2
-2
@@ -69,8 +69,8 @@ func limitBody(limit int64) func(http.Handler) http.Handler {
|
|||||||
|
|
||||||
const (
|
const (
|
||||||
defaultBodyLimit int64 = 1 * 1024 * 1024 // 1MB
|
defaultBodyLimit int64 = 1 * 1024 * 1024 // 1MB
|
||||||
uploadBodyLimit int64 = 15 * 1024 * 1024 // 15MB
|
uploadBodyLimit int64 = 20 * 1024 * 1024 // 20MB
|
||||||
portfolioBodyLimit int64 = 40 * 1024 * 1024 // 40MB (7 variants from 20MB source)
|
portfolioBodyLimit int64 = 30 * 1024 * 1024 // 30MB (7 variants)
|
||||||
)
|
)
|
||||||
|
|
||||||
// nColor / bColor — Chi-style ANSI colors for request logging.
|
// nColor / bColor — Chi-style ANSI colors for request logging.
|
||||||
|
|||||||
@@ -22,8 +22,6 @@
|
|||||||
|
|
||||||
// Move content to marker element when ready
|
// Move content to marker element when ready
|
||||||
|
|
||||||
// eslint-disable-next-line svelte/no-dom-manipulating
|
|
||||||
|
|
||||||
$effect(() => {
|
$effect(() => {
|
||||||
const element = markerCtx.getElement();
|
const element = markerCtx.getElement();
|
||||||
const ready = markerCtx.isReady();
|
const ready = markerCtx.isReady();
|
||||||
@@ -38,6 +36,7 @@
|
|||||||
// Move content back on cleanup
|
// Move content back on cleanup
|
||||||
movedContent.forEach((child) => {
|
movedContent.forEach((child) => {
|
||||||
if (wrapperElement && child.parentNode === element) {
|
if (wrapperElement && child.parentNode === element) {
|
||||||
|
// eslint-disable-next-line svelte/no-dom-manipulating
|
||||||
wrapperElement.appendChild(child);
|
wrapperElement.appendChild(child);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -43,8 +43,6 @@
|
|||||||
|
|
||||||
// Create popup when marker is ready
|
// Create popup when marker is ready
|
||||||
|
|
||||||
// eslint-disable-next-line svelte/no-dom-manipulating
|
|
||||||
|
|
||||||
$effect(() => {
|
$effect(() => {
|
||||||
const marker = markerCtx.getMarker();
|
const marker = markerCtx.getMarker();
|
||||||
const ready = markerCtx.isReady();
|
const ready = markerCtx.isReady();
|
||||||
|
|||||||
Reference in New Issue
Block a user