Ticket #284 (closed defect: fixed)

Opened 7 months ago

Last modified 7 months ago

parseQueryString returns extra cruft

Reported by: dairiki@dairiki.org Assigned to: somebody
Priority: normal Milestone:
Component: component1 Version:
Severity: normal Keywords:
Cc:

Description

This bug was apparently introduced in r1166, and still exists as of r1321.

The parenthesized group in the split regexp on line 1166 results in the parameter-separating ampersands being included in pairs. This, in turn, results in spurious parameters with names like "&" or "&" in the return value from parseQueryString.

The fix (which works for me, at least) is to eliminate the parenthesized group in the regexp, thus changing

var pairs = qstr.replace(/\+/g, "%20").split(/(\&amp\;|\&\#38\;|\&|\&)/);

to

var pairs = qstr.replace(/\+/g, "%20").split(/\&amp\;|\&\#38\;|\&|\&/);

(One could also use an anonymous grouping, e.g. (?: ... ), instead of the parenthesized grouping.)

Change History

12/14/07 12:11:04 changed by bob@redivi.com

  • status changed from new to closed.
  • resolution set to fixed.

resolved in r1323