Watch
1
0
Fork
You've already forked mautrix-whatsapp
0
mirror of https://github.com/mautrix/whatsapp.git synced 2026-08-22 03:58:08 -04:00

Compare commits

...
Author SHA1 Message Date
Nick Mills-Barrett
dc2a111078
directmedia: mark media retry decrypt failures as non-retryable 2026-08-21 15:46:43 +01:00

View file

@ -255,10 +255,11 @@ func (wa *WhatsAppConnector) makeDirectMediaResponse(
type directMediaRetry struct {
sync.Mutex
resultURL string
wait *exsync.Event
requested bool
resultType waMmsRetry.MediaRetryNotification_ResultType
resultURL string
wait *exsync.Event
requested bool
resultType waMmsRetry.MediaRetryNotification_ResultType
decryptFail bool
}
func (wa *WhatsAppClient) getDirectMediaRetryState(msgID networkid.MessageID, create bool) *directMediaRetry {
@ -285,6 +286,9 @@ func (wa *WhatsAppClient) requestAndWaitDirectMedia(ctx context.Context, rawMsgI
keys.DirectPath = state.resultURL
return nil
}
if state.decryptFail {
return mautrix.MNotFound.WithMessage("Unable to retrieve media: failed to decrypt the media retry notification from your phone.")
}
switch state.resultType {
case waMmsRetry.MediaRetryNotification_NOT_FOUND:
return mautrix.MNotFound.WithMessage("This media was not found on your phone.")
@ -338,6 +342,9 @@ func (wa *WhatsAppClient) receiveDirectMediaRetry(ctx context.Context, msg *data
retryData, err := whatsmeow.DecryptMediaRetryNotification(retry, keys.Key)
if err != nil {
log.Warn().Err(err).Msg("Failed to decrypt media retry notification")
if state != nil {
state.decryptFail = true
}
return
}
if state != nil {