]> 127.0.0.1 Git - bili_danmu/.git/commitdiff
Fix 某些情况下Cookie存储错误
authorqydysky <qydysky@foxmail.com>
Sun, 16 Apr 2023 18:50:45 +0000 (02:50 +0800)
committerqydysky <qydysky@foxmail.com>
Sun, 16 Apr 2023 18:50:45 +0000 (02:50 +0800)
F/CookieCrypo.go

index 70fba382abdb012bbd0c30653e902cc322fe1bd8..95873423b913e813ebe740185a57719ae5afb620 100644 (file)
@@ -71,7 +71,9 @@ func CookieSet(source []byte) {
                                pub = d
                        }
                } else {
-                       file.New(`cookie.txt`, 0, true).Write(append([]byte("nol"), source...), true)
+                       f := file.New(`cookie.txt`, 0, true)
+                       f.Delete()
+                       f.Write(append([]byte("nol"), source...), true)
                        return
                }
        }
@@ -79,6 +81,8 @@ func CookieSet(source []byte) {
                clog.L(`E: `, e)
                return
        } else {
-               file.New(`cookie.txt`, 0, true).Write(append([]byte("pem"), source...), true)
+               f := file.New(`cookie.txt`, 0, true)
+               f.Delete()
+               f.Write(append([]byte("pem"), source...), true)
        }
 }