1
0
mirror of https://github.com/Mrs4s/MiraiGo.git synced 2025-05-04 11:07:40 +08:00

fix '\r' .

This commit is contained in:
Mrs4s 2020-08-07 11:08:50 +08:00
parent 0a8d9254f8
commit ed30f7ad59
2 changed files with 13 additions and 5 deletions

View File

@ -146,10 +146,12 @@ func (info *DeviceInfo) ReadJson(d []byte) error {
return err
}
info.Display = []byte(f.Display)
info.Product = []byte(f.Product)
info.Device = []byte(f.Device)
info.Board = []byte(f.Board)
info.Model = []byte(f.Model)
if f.Product != "" {
info.Product = []byte(f.Product)
info.Device = []byte(f.Device)
info.Board = []byte(f.Board)
info.Model = []byte(f.Model)
}
info.FingerPrint = []byte(f.FingerPrint)
info.BootId = []byte(f.BootId)
info.ProcVersion = []byte(f.ProcVersion)

View File

@ -419,7 +419,13 @@ func ParseMessageElems(elems []*msg.Elem) []IMessageElement {
}
if elem.Text != nil {
if len(elem.Text.Attr6Buf) == 0 {
res = append(res, NewText(elem.Text.Str))
res = append(res, NewText(func() string {
// 这么处理应该没问题
if strings.Contains(elem.Text.Str, "\r") && !strings.Contains(elem.Text.Str, "\r\n") {
return strings.ReplaceAll(elem.Text.Str, "\r", "\r\n")
}
return elem.Text.Str
}()))
} else {
att6 := binary.NewReader(elem.Text.Attr6Buf)
att6.ReadBytes(7)