mirror of
https://github.com/Mrs4s/MiraiGo.git
synced 2025-05-04 11:07:40 +08:00
fix SendGroupMessage panic.
This commit is contained in:
parent
c6cb5c7fe2
commit
8ee19f6051
@ -7,7 +7,6 @@ import (
|
||||
"github.com/Mrs4s/MiraiGo/utils"
|
||||
"io"
|
||||
"os"
|
||||
"path"
|
||||
"runtime/debug"
|
||||
|
||||
"github.com/Mrs4s/MiraiGo/client/pb/oidb"
|
||||
@ -152,7 +151,7 @@ func (fs *GroupFileSystem) GetFilesByFolder(folderId string) ([]*GroupFile, []*G
|
||||
return files, folders, nil
|
||||
}
|
||||
|
||||
func (fs *GroupFileSystem) UploadFile(p, folderId string) error {
|
||||
func (fs *GroupFileSystem) UploadFile(p, name, folderId string) error {
|
||||
file, err := os.OpenFile(p, os.O_RDONLY, 0666)
|
||||
if err != nil {
|
||||
return err
|
||||
@ -163,7 +162,7 @@ func (fs *GroupFileSystem) UploadFile(p, folderId string) error {
|
||||
sha1H := sha1.New()
|
||||
_, _ = io.Copy(sha1H, file)
|
||||
sha1Hash := sha1H.Sum(nil)
|
||||
fs.client.sendAndWait(fs.client.buildGroupFileUploadReqPacket(folderId, path.Ext(p), fs.GroupCode, size, md5Hash, sha1Hash))
|
||||
fs.client.sendAndWait(fs.client.buildGroupFileUploadReqPacket(folderId, name, fs.GroupCode, size, md5Hash, sha1Hash))
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@ -355,7 +355,9 @@ func decodeGetGroupMsgResponse(c *QQClient, _ uint16, payload []byte) (interface
|
||||
if m.Head.FromUin == nil {
|
||||
continue
|
||||
}
|
||||
ret = append(ret, c.parseGroupMessage(m))
|
||||
if elem := c.parseGroupMessage(m); elem != nil {
|
||||
ret = append(ret, elem)
|
||||
}
|
||||
}
|
||||
return ret, nil
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user