From da0e9c78a51febf5a7c66950b7047c95a32cf0db Mon Sep 17 00:00:00 2001 From: Vitaly Puzrin Date: Tue, 13 Jan 2015 21:20:05 +0300 Subject: [PATCH] Added one more try/catch wrapper to normalizer, for safety --- lib/common/utils.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/common/utils.js b/lib/common/utils.js index 7665587..2a69999 100644 --- a/lib/common/utils.js +++ b/lib/common/utils.js @@ -181,7 +181,14 @@ function normalizeLink(url) { // Encoder throws exception on broken surrogate pairs. // Fix those first. - return encodeURI(fixBrokenSurrogates(normalized)); + + try { + return encodeURI(fixBrokenSurrogates(normalized)); + } catch (__) { + // This should never happen and left for safety only. + /*istanbul ignore next*/ + return ''; + } } ////////////////////////////////////////////////////////////////////////////////