summaryrefslogtreecommitdiffstats
path: root/vendor/go.mau.fi/whatsmeow/download.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/go.mau.fi/whatsmeow/download.go')
-rw-r--r--vendor/go.mau.fi/whatsmeow/download.go7
1 files changed, 4 insertions, 3 deletions
diff --git a/vendor/go.mau.fi/whatsmeow/download.go b/vendor/go.mau.fi/whatsmeow/download.go
index dd4aade0..6779478f 100644
--- a/vendor/go.mau.fi/whatsmeow/download.go
+++ b/vendor/go.mau.fi/whatsmeow/download.go
@@ -194,19 +194,20 @@ func (cli *Client) Download(msg DownloadableMessage) ([]byte, error) {
// DownloadMediaWithPath downloads an attachment by manually specifying the path and encryption details.
func (cli *Client) DownloadMediaWithPath(directPath string, encFileHash, fileHash, mediaKey []byte, fileLength int, mediaType MediaType, mmsType string) (data []byte, err error) {
- err = cli.refreshMediaConn(false)
+ var mediaConn *MediaConn
+ mediaConn, err = cli.refreshMediaConn(false)
if err != nil {
return nil, fmt.Errorf("failed to refresh media connections: %w", err)
}
if len(mmsType) == 0 {
mmsType = mediaTypeToMMSType[mediaType]
}
- for i, host := range cli.mediaConn.Hosts {
+ for i, host := range mediaConn.Hosts {
mediaURL := fmt.Sprintf("https://%s%s&hash=%s&mms-type=%s&__wa-mms=", host.Hostname, directPath, base64.URLEncoding.EncodeToString(encFileHash), mmsType)
data, err = cli.downloadAndDecrypt(mediaURL, mediaKey, mediaType, fileLength, encFileHash, fileHash)
// TODO there are probably some errors that shouldn't retry
if err != nil {
- if i >= len(cli.mediaConn.Hosts)-1 {
+ if i >= len(mediaConn.Hosts)-1 {
return nil, fmt.Errorf("failed to download media from last host: %w", err)
}
cli.Log.Warnf("Failed to download media: %s, trying with next host...", err)