From 2baf3c61092abb3157773fdcd52eeb7bf46e6b91 Mon Sep 17 00:00:00 2001 From: Blaster4385 Date: Tue, 23 Jul 2024 01:14:08 +0530 Subject: [PATCH] fix: enforce upload limit - also increase file size limit --- server/main.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/server/main.go b/server/main.go index 9a1efbd..cd2e445 100644 --- a/server/main.go +++ b/server/main.go @@ -20,7 +20,7 @@ import ( ) const ( - maxUploadSize = 10 * 1024 * 1024 // 10 MB + maxUploadSize = 3 * 1024 * 1024 * 1024 // 3 GB keySize = 32 nonceSize = 12 ) @@ -31,6 +31,7 @@ var db *sql.DB var dist embed.FS func registerHandlers(e *echo.Echo) { + e.Use(middleware.BodyLimit(fmt.Sprintf("%dM", maxUploadSize/(1024*1024)))) e.Use(middleware.StaticWithConfig(middleware.StaticConfig{ Root: "dist", Index: "upload.html",