diff options
author | Einar Egilsson | 2012-05-15 10:38:10 +0200 |
---|---|---|
committer | Einar Egilsson | 2012-05-15 10:38:10 +0200 |
commit | 404372326e9d854b065175ef1f4634fd78ca8afa (patch) | |
tree | 37ba66f07898e9b60a0ae96e96993d9af2d4a328 /chrome/js/redirect.js | |
parent | 134add6434541ad89f663cbdc1dcef8e9a76eab8 (diff) |
Removed proxyserver.js + fixed bug with empty captures
Diffstat (limited to 'chrome/js/redirect.js')
-rw-r--r-- | chrome/js/redirect.js | 13 |
1 files changed, 8 insertions, 5 deletions
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; |