Skip to content

Commit

Permalink
fix: issues #585
Browse files Browse the repository at this point in the history
  • Loading branch information
matheust3 committed Feb 12, 2021
1 parent 8e6c0db commit 1794097
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/api/whatsapp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -167,12 +167,12 @@ export class Whatsapp extends ControlsLayer {
* @returns Decrypted file buffer (null otherwise)
*/
public async decryptFile(message: Message) {
const options = makeOptions(useragentOverride),
clientUrl =
message.clientUrl !== undefined
? message.clientUrl
: message.deprecatedMms3Url;
if (!clientUrl) {
const options = makeOptions(useragentOverride);
message.clientUrl =
message.clientUrl !== undefined
? message.clientUrl
: message.deprecatedMms3Url;
if (!message.clientUrl) {
throw new Error(
'message is missing critical data needed to download the file.'
);
Expand All @@ -189,6 +189,7 @@ export class Whatsapp extends ControlsLayer {
}
}
} catch (error) {
console.error(error);
throw 'Error trying to download the file.';
}
const buff = Buffer.from(res.data, 'binary');
Expand Down

0 comments on commit 1794097

Please sign in to comment.