aboutsummaryrefslogtreecommitdiff
path: root/chrome/js/redirect.js
diff options
context:
space:
mode:
authorEinar Egilsson2012-05-15 10:38:10 +0200
committerEinar Egilsson2012-05-15 10:38:10 +0200
commit404372326e9d854b065175ef1f4634fd78ca8afa (patch)
tree37ba66f07898e9b60a0ae96e96993d9af2d4a328 /chrome/js/redirect.js
parent134add6434541ad89f663cbdc1dcef8e9a76eab8 (diff)
Removed proxyserver.js + fixed bug with empty captures
Diffstat (limited to 'chrome/js/redirect.js')
-rw-r--r--chrome/js/redirect.js13
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;