From 289d410a4b1ba7d1d1a1ed694e220c613c5791e3 Mon Sep 17 00:00:00 2001 From: Tulir Asokan Date: Mon, 2 May 2022 16:50:13 +0300 Subject: [PATCH] Use consistent error message for media not found errors Sometimes it's encrypted, sometimes it's not --- portal.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/portal.go b/portal.go index 1ee4fe1..1483292 100644 --- a/portal.go +++ b/portal.go @@ -2304,7 +2304,11 @@ func (portal *Portal) handleMediaRetry(retry *events.MediaRetry, source *User) { 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()) - portal.sendMediaRetryFailureEdit(intent, msg, fmt.Errorf("phone sent error response: %s", errorName)) + 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 }