Ticket #2327 (closed bug: fixed)

Opened 4 years ago

Last modified 3 years ago

OpenLayers.Util.getParameters not recognize %2C for comma separation

Reported by: memch Owned by:
Priority: critical Milestone: 2.9 Release
Component: Util Version: 2.8
Keywords: Cc:
State: Complete

Description

When i use OpenLayers.Util.getParameters for own parameters like tileurls=domain1/tile.php?z=${z}&x=${x}&y=${y},domain2/tile.php?z=${z}&x=${x}&y=${y}, some chars must be url-encoded when sended from a form (ENCTYPE = "application/x-www-form-urlencoded").

In that case, also that comma between this two urls gets encoded to %2C. The functionality behind OpenLayers.Util.getParameters do not recognize this encoded comma, and will never build an object from.

I found the bug in source in function "OpenLayers.Util.getParameters" (in OL 2.8 in Util.js line 922): On Line 940 a key will be searched with "decodeURIComponent", same for value on line 946. But the search for separating comma in value will be done before "decodeURIComponent" in encoded state. Here, a proper encoded comma is not ",", it is "%2C"!

 http://n2.nabble.com/OpenLayers-Util-getParameters-not-recognize-2C-for-comma-separation-td3895522.html

Attachments

getParameters.patch Download (1.6 KB) - added by adwyer 4 years ago.
2327.0.patch Download (2.1 KB) - added by fredj 3 years ago.
new version with more tests

Change History

Changed 4 years ago by adwyer

Changed 3 years ago by fredj

  • keywords getParameters decodeURIComponent comma separation removed
  • state set to Review

Changed 3 years ago by fredj

  • state changed from Review to Needs More Work

tests don't pass, new patch to come

Changed 3 years ago by fredj

new version with more tests

Changed 3 years ago by fredj

  • state changed from Needs More Work to Review

tests pass in chrome and FF 3.6. please review.

Changed 3 years ago by elemoine

  • state changed from Review to Commit

confirming that tests pass in Chromium 5 and FF 3.6, they also pass in IE8. Thanks for the patch, please commit.

Changed 3 years ago by fredj

  • status changed from new to closed
  • state changed from Commit to Complete
  • resolution set to fixed

(In [10071]) OpenLayers.Util.getParameters: decodeURIComponent the keys, not only the values. r=elemoine (closes #2327)

Note: See TracTickets for help on using tickets.