From ad753e7229f9dcafbefbeeccd3f6e73990cc6f71 Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Sat, 6 Apr 2024 19:03:02 +0200 Subject: [PATCH] Avoid infinite file reference refresh loops in case of unreachable media --- src/MTProtoSession/ResponseHandler.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/MTProtoSession/ResponseHandler.php b/src/MTProtoSession/ResponseHandler.php index 27445abb3..1263a6ade 100644 --- a/src/MTProtoSession/ResponseHandler.php +++ b/src/MTProtoSession/ResponseHandler.php @@ -291,7 +291,9 @@ trait ResponseHandler if ($response['error_message'] === 'PERSISTENT_TIMESTAMP_OUTDATED') { $response['error_code'] = 500; } - if (str_starts_with($response['error_message'], 'FILE_REFERENCE_')) { + if (str_starts_with($response['error_message'], 'FILE_REFERENCE_') + && $request->shouldRefreshReferences() + ) { $this->API->logger("Got {$response['error_message']}, refreshing file reference and repeating method call..."); $this->gotResponseForOutgoingMessage($request); $msgId = $request->getMsgId();