From ea980b4385e8119247029003a52adf8fb5533c89 Mon Sep 17 00:00:00 2001 From: lilia Date: Mon, 7 Dec 2015 16:52:45 -0800 Subject: [PATCH] Don't surface invalid attachment urls to the user Log them, but don't put display them in user-facing error ui. // FREEBIE --- js/libtextsecure.js | 6 ++++-- libtextsecure/api.js | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/js/libtextsecure.js b/js/libtextsecure.js index 996ba491..e4903f2a 100644 --- a/js/libtextsecure.js +++ b/js/libtextsecure.js @@ -36498,7 +36498,8 @@ var TextSecureServer = (function() { }).then(function(response) { var match = response.location.match(this.attachment_id_regex); if (!match) { - throw new Error('Received invalid attachment url: ' + response.location); + console.log('Invalid attachment url for incoming message', response.location); + throw new Error('Received invalid attachment url'); } return ajax(response.location, { type : "GET", @@ -36516,7 +36517,8 @@ var TextSecureServer = (function() { // (workaround for ids too large for Javascript numbers) var match = response.location.match(this.attachment_id_regex); if (!match) { - throw new Error('Received invalid attachment url: ' + response.location); + console.log('Invalid attachment url for outgoing message', response.location); + throw new Error('Received invalid attachment url'); } return ajax(response.location, { type : "PUT", diff --git a/libtextsecure/api.js b/libtextsecure/api.js index 8ae2e3b8..a72161d5 100644 --- a/libtextsecure/api.js +++ b/libtextsecure/api.js @@ -315,7 +315,8 @@ var TextSecureServer = (function() { }).then(function(response) { var match = response.location.match(this.attachment_id_regex); if (!match) { - throw new Error('Received invalid attachment url: ' + response.location); + console.log('Invalid attachment url for incoming message', response.location); + throw new Error('Received invalid attachment url'); } return ajax(response.location, { type : "GET", @@ -333,7 +334,8 @@ var TextSecureServer = (function() { // (workaround for ids too large for Javascript numbers) var match = response.location.match(this.attachment_id_regex); if (!match) { - throw new Error('Received invalid attachment url: ' + response.location); + console.log('Invalid attachment url for outgoing message', response.location); + throw new Error('Received invalid attachment url'); } return ajax(response.location, { type : "PUT",