fix: enforce upload limit

- also increase file size limit
This commit is contained in:
Blaster4385 2024-07-23 01:14:08 +05:30
parent 26cf8aa1cb
commit 2baf3c6109

View file

@ -20,7 +20,7 @@ import (
) )
const ( const (
maxUploadSize = 10 * 1024 * 1024 // 10 MB maxUploadSize = 3 * 1024 * 1024 * 1024 // 3 GB
keySize = 32 keySize = 32
nonceSize = 12 nonceSize = 12
) )
@ -31,6 +31,7 @@ var db *sql.DB
var dist embed.FS var dist embed.FS
func registerHandlers(e *echo.Echo) { func registerHandlers(e *echo.Echo) {
e.Use(middleware.BodyLimit(fmt.Sprintf("%dM", maxUploadSize/(1024*1024))))
e.Use(middleware.StaticWithConfig(middleware.StaticConfig{ e.Use(middleware.StaticWithConfig(middleware.StaticConfig{
Root: "dist", Root: "dist",
Index: "upload.html", Index: "upload.html",