diff --git a/webwhatsapi/js/wapi.js b/webwhatsapi/js/wapi.js index e8d7e49b..8df41007 100755 --- a/webwhatsapi/js/wapi.js +++ b/webwhatsapi/js/wapi.js @@ -996,7 +996,7 @@ window.WAPI.getProfilePicFromId = function (id, done) { window.WAPI.downloadFileWithCredentials = function (url, done) { let xhr = new XMLHttpRequest(); - + xhr.timeout = 30000; xhr.onload = function () { if (xhr.readyState == 4) { if (xhr.status == 200) { @@ -1014,6 +1014,10 @@ window.WAPI.downloadFileWithCredentials = function (url, done) { } }; + xhr.ontimeout = function (e) { + done(false); + }; + xhr.open("GET", url, true); xhr.withCredentials = true; xhr.responseType = 'blob'; @@ -1024,7 +1028,7 @@ window.WAPI.downloadFileWithCredentials = function (url, done) { window.WAPI.downloadFile = function (url, done) { let xhr = new XMLHttpRequest(); - + xhr.timeout = 30000; xhr.onload = function () { if (xhr.readyState == 4) { if (xhr.status == 200) { @@ -1042,6 +1046,10 @@ window.WAPI.downloadFile = function (url, done) { } }; + xhr.ontimeout = function (e) { + done(false); + }; + xhr.open("GET", url, true); xhr.responseType = 'blob'; xhr.send(null); diff --git a/webwhatsapi/objects/message.py b/webwhatsapi/objects/message.py index e7a72927..bd295458 100755 --- a/webwhatsapi/objects/message.py +++ b/webwhatsapi/objects/message.py @@ -64,6 +64,9 @@ def __init__(self, js_obj, driver=None): elif self.type == "revoked": self.content = "" self.safe_content = "..." + else: + self.content = "" + self.safe_content = self.type + "..." def __repr__(self): return "".format(