mirror of
https://github.com/tulir/mautrix-whatsapp
synced 2025-03-14 05:10:14 +01:00
Ignore media retry errors if the response contains a new URL
This commit is contained in:
parent
962179fb75
commit
30cf85a3b1
1 changed files with 10 additions and 6 deletions
16
portal.go
16
portal.go
|
@ -2344,14 +2344,18 @@ func (portal *Portal) handleMediaRetry(retry *events.MediaRetry, source *User) {
|
|||
return
|
||||
} else if retryData.GetResult() != waProto.MediaRetryNotification_SUCCESS {
|
||||
errorName := waProto.MediaRetryNotification_MediaRetryNotificationResultType_name[int32(retryData.GetResult())]
|
||||
portal.log.Warnfln("Got error response in media retry notification for %s: %s", retry.MessageID, errorName)
|
||||
portal.log.Debugfln("Error response contents: %s / %s", retryData.GetStanzaId(), retryData.GetDirectPath())
|
||||
if retryData.GetResult() == waProto.MediaRetryNotification_NOT_FOUND {
|
||||
portal.sendMediaRetryFailureEdit(intent, msg, whatsmeow.ErrMediaNotAvailableOnPhone)
|
||||
if retryData.GetDirectPath() == "" {
|
||||
portal.log.Warnfln("Got error response in media retry notification for %s: %s", retry.MessageID, errorName)
|
||||
portal.log.Debugfln("Error response contents: %s / %s", retryData.GetStanzaId(), retryData.GetDirectPath())
|
||||
if retryData.GetResult() == waProto.MediaRetryNotification_NOT_FOUND {
|
||||
portal.sendMediaRetryFailureEdit(intent, msg, whatsmeow.ErrMediaNotAvailableOnPhone)
|
||||
} else {
|
||||
portal.sendMediaRetryFailureEdit(intent, msg, fmt.Errorf("phone sent error response: %s", errorName))
|
||||
}
|
||||
return
|
||||
} else {
|
||||
portal.sendMediaRetryFailureEdit(intent, msg, fmt.Errorf("phone sent error response: %s", errorName))
|
||||
portal.log.Debugfln("Got error response %s in media retry notification for %s, but response also contains a new download URL - trying to download", retry.MessageID, errorName)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
data, err := source.Client.DownloadMediaWithPath(retryData.GetDirectPath(), meta.Media.EncSHA256, meta.Media.SHA256, meta.Media.Key, meta.Media.Length, meta.Media.Type, "")
|
||||
|
|
Loading…
Add table
Reference in a new issue