Being liberal in what we accept in query strings. A properly encoded '+' should be '%2B' in a URI component. A properly encoded ' ' (space) should be '%20'. When we encounter a '+', we can safely replace it with ' ' before properly decoding the remainder of the component. This follows the convention that '+' is used widely to represent a space in a URL. r=bartvde (closes #2527)

git-svn-id: http://svn.openlayers.org/trunk/openlayers@10133 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
Tim Schaub
2010-03-20 03:06:22 +00:00
parent fcfb22920b
commit 5038090d74
2 changed files with 19 additions and 3 deletions

View File

@@ -979,8 +979,8 @@ OpenLayers.Util.getParameters = function(url) {
var key = decodeURIComponent(keyValue[0]);
var value = keyValue[1] || ''; //empty string if no value
//decode individual values
value = decodeURIComponent(value).split(",");
//decode individual values (being liberal by replacing "+" with " ")
value = decodeURIComponent(value.replace(/\+/g, " ")).split(",");
//if there's only one value, do not return as array
if (value.length == 1) {