Skip to content

Commit

Permalink
download: don't retry for post-decrypt mismatches
Browse files Browse the repository at this point in the history
  • Loading branch information
tulir committed Jul 10, 2024
1 parent bd4d4e8 commit d732338
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion download.go
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ func (cli *Client) DownloadMediaWithPath(directPath string, encFileHash, fileHas
// TODO omit hash for unencrypted media?
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)
if err == nil {
if err == nil || errors.Is(err, ErrFileLengthMismatch) || errors.Is(err, ErrInvalidMediaSHA256) {
return
} else if i >= len(mediaConn.Hosts)-1 {
return nil, fmt.Errorf("failed to download media from last host: %w", err)
Expand Down

0 comments on commit d732338

Please sign in to comment.