Skip to main content
The MediaReupload struct provides a method to request the server to re-upload media when the original CDN URL has expired. This is essential for long-running bots that need to download media from older messages.

Access

Access media reupload operations through the client:

Methods

request

Request the server to re-upload media for a message with an expired URL.
&MediaReuploadRequest
required
Parameters identifying the media message to re-upload.
MediaRetryResult
The result of the reupload request. On success, contains a new direct_path for downloading.
Example:

Protocol flow

  1. The client encrypts a ServerErrorReceipt protobuf using an HKDF-derived key from the media key
  2. A <receipt type="server-error"> stanza is sent with the encrypted payload and <rmr> metadata
  3. The client waits up to 30 seconds for a <notification type="mediaretry"> response
  4. The response is decrypted and the new directPath is extracted

Types

MediaReuploadRequest

MediaRetryResult

Error handling

The method returns Result<MediaRetryResult>. The MediaRetryResult enum itself distinguishes between server-side success and failure. Additional errors can occur for:
  • Newsletter messages — Media reupload is not supported for newsletter messages
  • Timeout — The server did not respond within 30 seconds
  • Encryption failure — Failed to encrypt the retry request
  • Not logged in — Cannot determine own JID
Media reupload requests have a 30-second timeout. If the server does not respond in time, the request fails with a timeout error.
Media reupload is not supported for newsletter messages. Newsletter messages do not have media keys, so the encrypted retry protocol cannot be used.

See also