aboutsummaryrefslogtreecommitdiff
path: root/chrome/js/redirect.js
diff options
context:
space:
mode:
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;