From e771fe7d7b4e2f153a26051378e73dac6470ae53 Mon Sep 17 00:00:00 2001 From: Daniel <845765@qq.com> Date: Thu, 11 Jan 2024 20:13:25 +0800 Subject: [PATCH] :art: https://github.com/siyuan-note/siyuan/issues/10153 --- kernel/api/notification.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/kernel/api/notification.go b/kernel/api/notification.go index 00f9c0b74..704107680 100644 --- a/kernel/api/notification.go +++ b/kernel/api/notification.go @@ -18,6 +18,7 @@ package api import ( "net/http" + "strings" "github.com/88250/gulu" "github.com/gin-gonic/gin" @@ -33,7 +34,13 @@ func pushMsg(c *gin.Context) { return } - msg := arg["msg"].(string) + msg := strings.TrimSpace(arg["msg"].(string)) + if "" == msg { + ret.Code = -1 + ret.Msg = "msg can't be empty" + return + } + timeout := 7000 if nil != arg["timeout"] { timeout = int(arg["timeout"].(float64))