1
0
mirror of https://github.com/Mrs4s/MiraiGo.git synced 2025-05-07 12:43:32 +08:00

fix private image & lock.

This commit is contained in:
Mrs4s 2021-01-09 04:08:06 +08:00
parent bcedac03af
commit f765389e96
2 changed files with 3 additions and 0 deletions

View File

@ -204,6 +204,7 @@ func (c *QQClient) highwayUploadFileMultiThreadingByBDH(path string, cmdId int32
if err != nil {
return nil, errors.Wrap(err, "open file error")
}
defer file.Close()
if stat.Size() < 1024*1024*3 {
return c.highwayUploadByBDH(file, cmdId, ticket, ext, encrypt)
}

View File

@ -64,6 +64,7 @@ func (c *QQClient) UploadGroupImageByFile(groupCode int64, path string) (*messag
if err != nil {
return nil, err
}
defer img.Close()
fh, length := utils.ComputeMd5AndLength(img)
seq, pkt := c.buildGroupImageStorePacket(groupCode, fh[:], int32(length))
r, err := c.sendAndWait(seq, pkt)
@ -104,6 +105,7 @@ func (c *QQClient) UploadPrivateImage(target int64, img io.ReadSeeker) (*message
}
func (c *QQClient) uploadPrivateImage(target int64, img io.ReadSeeker, count int) (*message.FriendImageElement, error) {
_, _ = img.Seek(0, io.SeekStart)
count++
fh, length := utils.ComputeMd5AndLength(img)
_, _ = img.Seek(0, io.SeekStart)