Update dependencies (#1841)
This commit is contained in:
12
vendor/go.mau.fi/whatsmeow/download.go
vendored
12
vendor/go.mau.fi/whatsmeow/download.go
vendored
@@ -13,6 +13,7 @@ import (
|
||||
"fmt"
|
||||
"io"
|
||||
"net/http"
|
||||
"strings"
|
||||
|
||||
"google.golang.org/protobuf/proto"
|
||||
"google.golang.org/protobuf/reflect/protoreflect"
|
||||
@@ -183,11 +184,20 @@ func (cli *Client) Download(msg DownloadableMessage) ([]byte, error) {
|
||||
return nil, fmt.Errorf("%w '%s'", ErrUnknownMediaType, string(msg.ProtoReflect().Descriptor().Name()))
|
||||
}
|
||||
urlable, ok := msg.(downloadableMessageWithURL)
|
||||
if ok && len(urlable.GetUrl()) > 0 {
|
||||
var url string
|
||||
var isWebWhatsappNetURL bool
|
||||
if ok {
|
||||
url = urlable.GetUrl()
|
||||
isWebWhatsappNetURL = strings.HasPrefix(urlable.GetUrl(), "https://web.whatsapp.net")
|
||||
}
|
||||
if len(url) > 0 && !isWebWhatsappNetURL {
|
||||
return cli.downloadAndDecrypt(urlable.GetUrl(), msg.GetMediaKey(), mediaType, getSize(msg), msg.GetFileEncSha256(), msg.GetFileSha256())
|
||||
} else if len(msg.GetDirectPath()) > 0 {
|
||||
return cli.DownloadMediaWithPath(msg.GetDirectPath(), msg.GetFileEncSha256(), msg.GetFileSha256(), msg.GetMediaKey(), getSize(msg), mediaType, mediaTypeToMMSType[mediaType])
|
||||
} else {
|
||||
if isWebWhatsappNetURL {
|
||||
cli.Log.Warnf("Got a media message with a web.whatsapp.net URL (%s) and no direct path", url)
|
||||
}
|
||||
return nil, ErrNoURLPresent
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user