]> 127.0.0.1 Git - bili_danmu/.git/commitdiff
Fix 表情代码包含文件名非法字符
authorqydysky <qydysky@foxmail.com>
Sun, 28 Jul 2024 10:09:24 +0000 (18:09 +0800)
committerqydysky <qydysky@foxmail.com>
Sun, 28 Jul 2024 10:09:24 +0000 (18:09 +0800)
Reply/F/danmuEmotes/danmuEmotes.go

index 1b3d45489221cd87745f9918b74750c1595a4d45..22bd3f9eb7d7623b32032ca13658b92e7c313367 100644 (file)
@@ -52,10 +52,10 @@ func saveEmote(ctx context.Context, ptr Danmu) (ret any, err error) {
                if url, ok := m[`url`].(string); ok {
                        if !strings.Contains(*ptr.Msg, "[") {
                                if emoticon_unique, ok := m[`emoticon_unique`].(string); ok {
-                                       *ptr.Msg = "[" + hashr(*ptr.Msg+emoticon_unique) + "]"
+                                       *ptr.Msg = "[" + *ptr.Msg + emoticon_unique + "]"
                                }
                        }
-
+                       *ptr.Msg = hashr(*ptr.Msg)
                        savePath := "emots/" + *ptr.Msg + ".png"
                        if !file.New(savePath, 0, true).IsExist() {
                                go func() {
@@ -103,7 +103,7 @@ func saveEmote(ctx context.Context, ptr Danmu) (ret any, err error) {
                                                        continue
                                                }
 
-                                               savePath := hashr("emots/" + k + ".png")
+                                               savePath := "emots/" + hashr(k) + ".png"
                                                if file.New(savePath, 0, true).IsExist() {
                                                        continue
                                                }