🎨 Escape the notification message https://github.com/siyuan-note/siyuan/issues/7811
This commit is contained in:
parent
7dbfa43de4
commit
0a10285167
7 changed files with 14 additions and 8 deletions
|
@ -33,6 +33,7 @@ import (
|
||||||
|
|
||||||
"github.com/88250/gulu"
|
"github.com/88250/gulu"
|
||||||
"github.com/88250/lute/ast"
|
"github.com/88250/lute/ast"
|
||||||
|
"github.com/88250/lute/html"
|
||||||
"github.com/88250/lute/parse"
|
"github.com/88250/lute/parse"
|
||||||
"github.com/dustin/go-humanize"
|
"github.com/dustin/go-humanize"
|
||||||
"github.com/gabriel-vasile/mimetype"
|
"github.com/gabriel-vasile/mimetype"
|
||||||
|
@ -354,7 +355,7 @@ func uploadAssets2Cloud(sqlAssets []*sql.Asset, bizType string) (err error) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
msg := fmt.Sprintf(Conf.Language(27), absAsset)
|
msg := fmt.Sprintf(Conf.Language(27), html.EscapeString(absAsset))
|
||||||
util.PushStatusBar(msg)
|
util.PushStatusBar(msg)
|
||||||
util.PushUpdateMsg(msgId, msg, 3000)
|
util.PushUpdateMsg(msgId, msg, 3000)
|
||||||
|
|
||||||
|
|
|
@ -31,6 +31,7 @@ import (
|
||||||
|
|
||||||
"github.com/88250/gulu"
|
"github.com/88250/gulu"
|
||||||
"github.com/88250/lute/ast"
|
"github.com/88250/lute/ast"
|
||||||
|
"github.com/88250/lute/html"
|
||||||
"github.com/88250/lute/parse"
|
"github.com/88250/lute/parse"
|
||||||
"github.com/dustin/go-humanize"
|
"github.com/dustin/go-humanize"
|
||||||
"github.com/facette/natsort"
|
"github.com/facette/natsort"
|
||||||
|
@ -403,7 +404,7 @@ func (box *Box) moveTrees0(files []*FileInfo) {
|
||||||
|
|
||||||
treenode.SetBlockTreePath(subTree)
|
treenode.SetBlockTreePath(subTree)
|
||||||
sql.RenameSubTreeQueue(subTree)
|
sql.RenameSubTreeQueue(subTree)
|
||||||
msg := fmt.Sprintf(Conf.Language(107), subTree.HPath)
|
msg := fmt.Sprintf(Conf.Language(107), html.EscapeString(subTree.HPath))
|
||||||
util.PushStatusBar(msg)
|
util.PushStatusBar(msg)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,6 +28,7 @@ import (
|
||||||
|
|
||||||
"github.com/88250/gulu"
|
"github.com/88250/gulu"
|
||||||
"github.com/88250/lute/ast"
|
"github.com/88250/lute/ast"
|
||||||
|
"github.com/88250/lute/html"
|
||||||
"github.com/88250/lute/parse"
|
"github.com/88250/lute/parse"
|
||||||
"github.com/dustin/go-humanize"
|
"github.com/dustin/go-humanize"
|
||||||
"github.com/panjf2000/ants/v2"
|
"github.com/panjf2000/ants/v2"
|
||||||
|
@ -76,7 +77,7 @@ func index(boxID string) {
|
||||||
var treeCount int
|
var treeCount int
|
||||||
var treeSize int64
|
var treeSize int64
|
||||||
i := 0
|
i := 0
|
||||||
util.PushStatusBar(fmt.Sprintf("["+box.Name+"] "+Conf.Language(64), len(files)))
|
util.PushStatusBar(fmt.Sprintf("["+html.EscapeString(box.Name)+"] "+Conf.Language(64), len(files)))
|
||||||
|
|
||||||
poolSize := runtime.NumCPU()
|
poolSize := runtime.NumCPU()
|
||||||
if 4 < poolSize {
|
if 4 < poolSize {
|
||||||
|
|
|
@ -447,6 +447,6 @@ func reindexTree0(tree *parse.Tree, i, size int) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if 0 == i%64 {
|
if 0 == i%64 {
|
||||||
util.PushStatusBar(fmt.Sprintf(Conf.Language(183), i, size, html.EscapeHTMLStr(path.Base(tree.HPath))))
|
util.PushStatusBar(fmt.Sprintf(Conf.Language(183), i, size, html.EscapeString(path.Base(tree.HPath))))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,6 +36,7 @@ import (
|
||||||
"github.com/88250/gulu"
|
"github.com/88250/gulu"
|
||||||
"github.com/88250/lute"
|
"github.com/88250/lute"
|
||||||
"github.com/88250/lute/ast"
|
"github.com/88250/lute/ast"
|
||||||
|
"github.com/88250/lute/html"
|
||||||
"github.com/88250/lute/parse"
|
"github.com/88250/lute/parse"
|
||||||
"github.com/88250/lute/render"
|
"github.com/88250/lute/render"
|
||||||
"github.com/dustin/go-humanize"
|
"github.com/dustin/go-humanize"
|
||||||
|
@ -811,7 +812,7 @@ func IndexRepo(memo string) (err error) {
|
||||||
eventbus.CtxPushMsg: eventbus.CtxPushMsgToStatusBarAndProgress,
|
eventbus.CtxPushMsg: eventbus.CtxPushMsgToStatusBarAndProgress,
|
||||||
})
|
})
|
||||||
if nil != err {
|
if nil != err {
|
||||||
util.PushStatusBar("Index data repo failed: " + err.Error())
|
util.PushStatusBar("Index data repo failed: " + html.EscapeString(err.Error()))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
elapsed := time.Since(start)
|
elapsed := time.Since(start)
|
||||||
|
@ -992,7 +993,7 @@ func bootSyncRepo() (err error) {
|
||||||
autoSyncErrCount++
|
autoSyncErrCount++
|
||||||
planSyncAfter(fixSyncInterval)
|
planSyncAfter(fixSyncInterval)
|
||||||
|
|
||||||
msg := fmt.Sprintf("sync repo failed: %s", err)
|
msg := fmt.Sprintf("sync repo failed: %s", html.EscapeString(err.Error()))
|
||||||
logging.LogErrorf(msg)
|
logging.LogErrorf(msg)
|
||||||
util.PushStatusBar(msg)
|
util.PushStatusBar(msg)
|
||||||
util.PushErrMsg(msg, 0)
|
util.PushErrMsg(msg, 0)
|
||||||
|
|
|
@ -27,6 +27,7 @@ import (
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/88250/gulu"
|
"github.com/88250/gulu"
|
||||||
|
"github.com/88250/lute/html"
|
||||||
"github.com/dustin/go-humanize"
|
"github.com/dustin/go-humanize"
|
||||||
"github.com/siyuan-note/dejavu"
|
"github.com/siyuan-note/dejavu"
|
||||||
"github.com/siyuan-note/dejavu/cloud"
|
"github.com/siyuan-note/dejavu/cloud"
|
||||||
|
@ -495,7 +496,7 @@ func ListCloudSyncDir() (syncDirs []*Sync, hSize string, err error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func formatRepoErrorMsg(err error) string {
|
func formatRepoErrorMsg(err error) string {
|
||||||
msg := err.Error()
|
msg := html.EscapeString(err.Error())
|
||||||
if errors.Is(err, cloud.ErrCloudAuthFailed) {
|
if errors.Is(err, cloud.ErrCloudAuthFailed) {
|
||||||
msg = Conf.Language(31)
|
msg = Conf.Language(31)
|
||||||
} else if errors.Is(err, cloud.ErrCloudObjectNotFound) {
|
} else if errors.Is(err, cloud.ErrCloudObjectNotFound) {
|
||||||
|
|
|
@ -29,6 +29,7 @@ import (
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/88250/gulu"
|
"github.com/88250/gulu"
|
||||||
|
"github.com/88250/lute/html"
|
||||||
"github.com/dustin/go-humanize"
|
"github.com/dustin/go-humanize"
|
||||||
"github.com/siyuan-note/logging"
|
"github.com/siyuan-note/logging"
|
||||||
)
|
)
|
||||||
|
@ -123,7 +124,7 @@ func Tesseract(imgAbsPath string) string {
|
||||||
ret := string(output)
|
ret := string(output)
|
||||||
ret = gulu.Str.RemoveInvisible(ret)
|
ret = gulu.Str.RemoveInvisible(ret)
|
||||||
ret = RemoveRedundantSpace(ret)
|
ret = RemoveRedundantSpace(ret)
|
||||||
msg := fmt.Sprintf("OCR [%s] [%s]", info.Name(), ret)
|
msg := fmt.Sprintf("OCR [%s] [%s]", html.EscapeString(info.Name()), html.EscapeString(ret))
|
||||||
PushStatusBar(msg)
|
PushStatusBar(msg)
|
||||||
return ret
|
return ret
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue