Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Failure to upload video message content will cause the SDK to crash #480

Merged
merged 9 commits into from
Jan 5, 2024
4 changes: 3 additions & 1 deletion internal/conversation_msg/sdk.go
Original file line number Diff line number Diff line change
Expand Up @@ -554,7 +554,9 @@ func (c *Conversation) SendMessage(ctx context.Context, s *sdk_struct.MsgStruct,
c.updateMsgStatusAndTriggerConversation(ctx, s.ClientMsgID, "", s.CreateTime, constant.MsgStatusSendFailed, s, lc)
putErrs = err
}
s.VideoElem.VideoURL = res.URL
if res != nil {
s.VideoElem.VideoURL = res.URL
}
}()
wg.Wait()
if err := putErrs; err != nil {
Expand Down
15 changes: 9 additions & 6 deletions internal/file/upload.go
Original file line number Diff line number Diff line change
Expand Up @@ -435,17 +435,20 @@ func (f *File) getUpload(ctx context.Context, req *third.InitiateMultipartUpload
} else {
bitmap = ParseBitmap(bitmapBytes, partNum)
}
tUpInfo := &third.UploadInfo{
PartSize: req.PartSize,
Sign: &third.AuthSignParts{},
}
if dbUpload != nil {
tUpInfo.UploadID = dbUpload.UploadID
tUpInfo.ExpireTime = dbUpload.ExpireTime
}
return &UploadInfo{
PartNum: partNum,
Bitmap: bitmap,
DBInfo: dbUpload,
Resp: &third.InitiateMultipartUploadResp{
Upload: &third.UploadInfo{
UploadID: dbUpload.UploadID,
PartSize: req.PartSize,
ExpireTime: dbUpload.ExpireTime,
Sign: &third.AuthSignParts{},
},
Upload: tUpInfo,
},
BatchSignNum: req.MaxParts,
f: f,
Expand Down