From 6de8273150a2d8314c8c9535e4c7259602ce8047 Mon Sep 17 00:00:00 2001 From: FChannel <> Date: Sat, 16 Jul 2022 08:27:23 -0700 Subject: increased comment limit check if inReplyTo is NaN, check if from.Value nil --- route/routes/actor.go | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'route/routes') diff --git a/route/routes/actor.go b/route/routes/actor.go index 7cc11ae..4df801e 100644 --- a/route/routes/actor.go +++ b/route/routes/actor.go @@ -3,6 +3,7 @@ package routes import ( "bytes" "encoding/json" + "errors" "io" "io/ioutil" "mime/multipart" @@ -231,9 +232,9 @@ func MakeActorPost(ctx *fiber.Ctx) error { } } - if len(ctx.FormValue("comment")) > 2000 { + if len(ctx.FormValue("comment")) > 4500 { return ctx.Render("403", fiber.Map{ - "message": "Comment limit 2000 characters", + "message": "Comment limit 4500 characters", }) } @@ -277,6 +278,10 @@ func MakeActorPost(ctx *fiber.Ctx) error { form, _ := ctx.MultipartForm() + if form.Value == nil { + return util.MakeError(errors.New("form value nil"), "ActorPost") + } + for key, r0 := range form.Value { if key == "captcha" { err := we.WriteField(key, ctx.FormValue("captchaCode")+":"+ctx.FormValue("captcha")) @@ -303,7 +308,7 @@ func MakeActorPost(ctx *fiber.Ctx) error { } } - if ctx.FormValue("inReplyTo") == "" && reply != "" { + if (ctx.FormValue("inReplyTo") == "" || ctx.FormValue("inReplyTo") == "NaN") && reply != "" { err := we.WriteField("inReplyTo", reply) if err != nil { return util.MakeError(err, "ActorPost") -- cgit v1.2.3