Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/dev' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
Vanessa219 committed May 15, 2023
2 parents 6ca6817 + 0a10285 commit 7d58ab0
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 8 deletions.
3 changes: 2 additions & 1 deletion kernel/model/assets.go
Expand Up @@ -33,6 +33,7 @@ import (

"github.com/88250/gulu"
"github.com/88250/lute/ast"
"github.com/88250/lute/html"
"github.com/88250/lute/parse"
"github.com/dustin/go-humanize"
"github.com/gabriel-vasile/mimetype"
Expand Down Expand Up @@ -354,7 +355,7 @@ func uploadAssets2Cloud(sqlAssets []*sql.Asset, bizType string) (err error) {
continue
}

msg := fmt.Sprintf(Conf.Language(27), absAsset)
msg := fmt.Sprintf(Conf.Language(27), html.EscapeString(absAsset))
util.PushStatusBar(msg)
util.PushUpdateMsg(msgId, msg, 3000)

Expand Down
3 changes: 2 additions & 1 deletion kernel/model/box.go
Expand Up @@ -31,6 +31,7 @@ import (

"github.com/88250/gulu"
"github.com/88250/lute/ast"
"github.com/88250/lute/html"
"github.com/88250/lute/parse"
"github.com/dustin/go-humanize"
"github.com/facette/natsort"
Expand Down Expand Up @@ -403,7 +404,7 @@ func (box *Box) moveTrees0(files []*FileInfo) {

treenode.SetBlockTreePath(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)
}
}
Expand Down
3 changes: 2 additions & 1 deletion kernel/model/index.go
Expand Up @@ -28,6 +28,7 @@ import (

"github.com/88250/gulu"
"github.com/88250/lute/ast"
"github.com/88250/lute/html"
"github.com/88250/lute/parse"
"github.com/dustin/go-humanize"
"github.com/panjf2000/ants/v2"
Expand Down Expand Up @@ -76,7 +77,7 @@ func index(boxID string) {
var treeCount int
var treeSize int64
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()
if 4 < poolSize {
Expand Down
2 changes: 1 addition & 1 deletion kernel/model/index_fix.go
Expand Up @@ -447,6 +447,6 @@ func reindexTree0(tree *parse.Tree, i, size int) {
}

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))))
}
}
5 changes: 3 additions & 2 deletions kernel/model/repository.go
Expand Up @@ -36,6 +36,7 @@ import (
"github.com/88250/gulu"
"github.com/88250/lute"
"github.com/88250/lute/ast"
"github.com/88250/lute/html"
"github.com/88250/lute/parse"
"github.com/88250/lute/render"
"github.com/dustin/go-humanize"
Expand Down Expand Up @@ -811,7 +812,7 @@ func IndexRepo(memo string) (err error) {
eventbus.CtxPushMsg: eventbus.CtxPushMsgToStatusBarAndProgress,
})
if nil != err {
util.PushStatusBar("Index data repo failed: " + err.Error())
util.PushStatusBar("Index data repo failed: " + html.EscapeString(err.Error()))
return
}
elapsed := time.Since(start)
Expand Down Expand Up @@ -992,7 +993,7 @@ func bootSyncRepo() (err error) {
autoSyncErrCount++
planSyncAfter(fixSyncInterval)

msg := fmt.Sprintf("sync repo failed: %s", err)
msg := fmt.Sprintf("sync repo failed: %s", html.EscapeString(err.Error()))
logging.LogErrorf(msg)
util.PushStatusBar(msg)
util.PushErrMsg(msg, 0)
Expand Down
3 changes: 2 additions & 1 deletion kernel/model/sync.go
Expand Up @@ -27,6 +27,7 @@ import (
"time"

"github.com/88250/gulu"
"github.com/88250/lute/html"
"github.com/dustin/go-humanize"
"github.com/siyuan-note/dejavu"
"github.com/siyuan-note/dejavu/cloud"
Expand Down Expand Up @@ -495,7 +496,7 @@ func ListCloudSyncDir() (syncDirs []*Sync, hSize string, err error) {
}

func formatRepoErrorMsg(err error) string {
msg := err.Error()
msg := html.EscapeString(err.Error())
if errors.Is(err, cloud.ErrCloudAuthFailed) {
msg = Conf.Language(31)
} else if errors.Is(err, cloud.ErrCloudObjectNotFound) {
Expand Down
3 changes: 2 additions & 1 deletion kernel/util/tesseract.go
Expand Up @@ -29,6 +29,7 @@ import (
"time"

"github.com/88250/gulu"
"github.com/88250/lute/html"
"github.com/dustin/go-humanize"
"github.com/siyuan-note/logging"
)
Expand Down Expand Up @@ -123,7 +124,7 @@ func Tesseract(imgAbsPath string) string {
ret := string(output)
ret = gulu.Str.RemoveInvisible(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)
return ret
}
Expand Down

0 comments on commit 7d58ab0

Please sign in to comment.