dkforest

A forum and chat platform (onion)
git clone https://git.dasho.dev/n0tr1v/dkforest.git
Log | Files | Refs | LICENSE

commit 182d023cf57a5178aba9e044f54937f8189823ac
parent b053ae0f4262991677fdb40457fa2b1238f338cf
Author: n0tr1v <n0tr1v@protonmail.com>
Date:   Thu,  6 Apr 2023 13:08:14 -0700

fix choice function

Diffstat:
Mpkg/web/handlers/api/v1/slashInterceptor.go | 3++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/pkg/web/handlers/api/v1/slashInterceptor.go b/pkg/web/handlers/api/v1/slashInterceptor.go @@ -14,6 +14,7 @@ import ( "github.com/asaskevich/govalidator" "github.com/dustin/go-humanize" "github.com/sirupsen/logrus" + "html" "os" "path/filepath" "sort" @@ -474,7 +475,7 @@ func handleRandCmd(c *Command) (handled bool) { func handleChoiceCmd(c *Command) (handled bool) { if strings.HasPrefix(c.message, "/choice ") { - tmp := strings.TrimPrefix(c.message, "/choice ") + tmp := html.EscapeString(strings.TrimPrefix(c.message, "/choice ")) words := strings.Fields(tmp) answer := utils.RandChoice(words) raw := fmt.Sprintf(`@%s choice %s ... "%s"`, c.authUser.Username, words, answer)