Skip to content

Commit 6a82a47

Browse files
committed
Parser: Two bugfixes, see below.
1. Use regexes to make sure strings are replaced globally 2. Use \0x1f (invisible unit separator char) as placeholder instead of \0xff which is ÿ (and might reasonably appear in the argstring).
1 parent d5f3bef commit 6a82a47

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

src/core/parser.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -229,8 +229,10 @@ define([
229229

230230
_parseExtendedNotation: function argParserParseExtendedNotation(argstring) {
231231
var opts = {};
232-
var parts = argstring.replace(";;", "\xff").replace("&", "&amp\xff").split(/;/)
233-
.map(function(el) { return el.replace("\xff", ";"); });
232+
var parts = argstring.replace(/;;/g, "\0x1f").replace(/&/g, "&amp\0x1f").split(/;/)
233+
.map(function(el) {
234+
return el.replace(new RegExp("\0x1f", 'g'), ";");
235+
});
234236
_.each(parts, function (part, i) {
235237
if (!part) { return; }
236238
var matches = part.match(this.named_param_pattern);

src/pat/inject/inject.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -414,7 +414,7 @@ define([
414414
if (cfgs[0].nextHref && $el.is("a")) {
415415
// In case next-href is specified the anchor's href will
416416
// be set to it after the injection is triggered.
417-
$el.attr({href: cfgs[0].nextHref});
417+
$el.attr({href: cfgs[0].nextHref.replace(/&/g, '&')});
418418
inject.destroy($el);
419419
}
420420
$el.off("pat-ajax-success.pat-inject");

0 commit comments

Comments
 (0)