From 404372326e9d854b065175ef1f4634fd78ca8afa Mon Sep 17 00:00:00 2001 From: Einar Egilsson Date: Tue, 15 May 2012 10:38:10 +0200 Subject: Removed proxyserver.js + fixed bug with empty captures --- chrome/js/redirect.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'chrome/js/redirect.js') diff --git a/chrome/js/redirect.js b/chrome/js/redirect.js index 4a05ef8..eab14f8 100644 --- a/chrome/js/redirect.js +++ b/chrome/js/redirect.js @@ -202,11 +202,14 @@ Redirect.prototype = { } var resultUrl = this.redirectUrl; for (var i = 1; i < matches.length; i++) { - resultUrl = resultUrl.replace(new RegExp('\\$' + i, 'gi'), - this.unescapeMatches ? unescape(matches[i]) : - this.escapeMatches ? encodeURIComponent(matches[i]) : - matches[i] - ); + var repl = matches[i] || ''; + if (this.unescapeMatches) { + repl = unescape(repl); + } + if (this.escapeMatches) { + repl = encodeURIComponent(repl); + } + resultUrl = resultUrl.replace(new RegExp('\\$' + i, 'gi'), repl); } this._rxInclude.lastIndex = 0; return resultUrl; -- cgit v1.2.3-70-g09d2