aboutsummaryrefslogtreecommitdiff
path: root/route/routes/actor.go
diff options
context:
space:
mode:
Diffstat (limited to 'route/routes/actor.go')
-rw-r--r--route/routes/actor.go9
1 files changed, 8 insertions, 1 deletions
diff --git a/route/routes/actor.go b/route/routes/actor.go
index 1072472..83cbca2 100644
--- a/route/routes/actor.go
+++ b/route/routes/actor.go
@@ -8,6 +8,7 @@ import (
"net/http"
"regexp"
"strconv"
+ "strings"
"github.com/FChannel0/FChannel-Server/activitypub"
"github.com/FChannel0/FChannel-Server/config"
@@ -238,7 +239,7 @@ func ActorPost(ctx *fiber.Ctx) error {
}
if ctx.FormValue("inReplyTo") == "" || file == nil {
- if ctx.FormValue("comment") == "" && ctx.FormValue("subject") == "" {
+ if strings.TrimSpace(ctx.FormValue("comment")) == "" && ctx.FormValue("subject") == "" {
return ctx.Render("403", fiber.Map{
"message": "Comment or Subject required",
})
@@ -251,6 +252,12 @@ func ActorPost(ctx *fiber.Ctx) error {
})
}
+ if strings.Count(ctx.FormValue("comment"), "\r\n") > 50 || strings.Count(ctx.FormValue("comment"), "\n") > 50 || strings.Count(ctx.FormValue("comment"), "\r") > 50 {
+ return ctx.Render("403", fiber.Map{
+ "message": "Too many new lines - try again.",
+ })
+ }
+
if len(ctx.FormValue("subject")) > 100 || len(ctx.FormValue("name")) > 100 || len(ctx.FormValue("options")) > 100 {
return ctx.Render("403", fiber.Map{
"message": "Name, Subject or Options limit 100 characters",