mirror of
https://github.com/tgdrive/teldrive.git
synced 2025-09-06 22:45:03 +08:00
refactor: verify if part is uploaded before returning
This commit is contained in:
parent
6839766e0a
commit
5f0f1831e5
1 changed files with 8 additions and 0 deletions
|
@ -249,6 +249,14 @@ func (us *UploadService) UploadFile(c *gin.Context) (*schemas.UploadPartOut, *ty
|
|||
return err
|
||||
}
|
||||
|
||||
//verify if the part is uploaded
|
||||
msgs, _ := client.ChannelsGetMessages(ctx,
|
||||
&tg.ChannelsGetMessagesRequest{Channel: channel, ID: []tg.InputMessageClass{&tg.InputMessageID{ID: message.ID}}})
|
||||
|
||||
if msgs != nil && len(msgs.(*tg.MessagesChannelMessages).Messages) == 0 {
|
||||
return errors.New("upload failed")
|
||||
}
|
||||
|
||||
out = mapper.ToUploadOut(partUpload)
|
||||
|
||||
return nil
|
||||
|
|
Loading…
Add table
Reference in a new issue