diff options
Diffstat (limited to 'vendor/go.mau.fi/whatsmeow/download.go')
-rw-r--r-- | vendor/go.mau.fi/whatsmeow/download.go | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/vendor/go.mau.fi/whatsmeow/download.go b/vendor/go.mau.fi/whatsmeow/download.go index 6779478f..e9b8d4f1 100644 --- a/vendor/go.mau.fi/whatsmeow/download.go +++ b/vendor/go.mau.fi/whatsmeow/download.go @@ -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 } } |