1
0
mirror of https://github.com/Mrs4s/MiraiGo.git synced 2025-05-04 19:17:38 +08:00

fix light app decode bug.

This commit is contained in:
Mrs4s 2020-11-09 15:26:24 +08:00
parent ca72d542ca
commit 3c7b0b8c8e

View File

@ -366,16 +366,16 @@ func ParseMessageElems(elems []*msg.Elem) []IMessageElement {
} }
} }
if elem.LightApp != nil && len(elem.LightApp.Data) > 1 { if elem.LightApp != nil && len(elem.LightApp.Data) > 1 {
var content string var content []byte
if elem.LightApp.Data[0] == 0 { if elem.LightApp.Data[0] == 0 {
content = string(elem.LightApp.Data[1:]) content = elem.LightApp.Data[1:]
} }
if elem.LightApp.Data[0] == 1 { if elem.LightApp.Data[0] == 1 {
content = string(binary.ZlibUncompress(elem.LightApp.Data[1:])) content = binary.ZlibUncompress(elem.LightApp.Data[1:])
} }
if content != "" { if len(content) > 0 && len(content) < 1024*1024*1024 { // 解析出错 or 非法内容
// TODO: 解析具体的APP // TODO: 解析具体的APP
return append(res, &LightAppElement{Content: content}) return append(res, &LightAppElement{Content: string(content)})
} }
} }
if elem.VideoFile != nil { if elem.VideoFile != nil {