From 6dd3dc9f591327376207aade88a249a80016d866 Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Fri, 6 Jan 2012 14:09:43 +0100 Subject: [PATCH] BUGFIX Support for commas in URLs processed by Requirements and jQuery.ondemand (which uses commas to serialise its dependency data into HTTP headers) --- javascript/jquery-ondemand/jquery.ondemand.js | 15 ++++++++++----- view/Requirements.php | 9 +++++++-- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/javascript/jquery-ondemand/jquery.ondemand.js b/javascript/jquery-ondemand/jquery.ondemand.js index 29a891bed..674a58da8 100644 --- a/javascript/jquery-ondemand/jquery.ondemand.js +++ b/javascript/jquery-ondemand/jquery.ondemand.js @@ -15,6 +15,10 @@ */ (function($){ + var decodePath = function(str) { + return str.replace(/%2C/g,',').replace(/\&/g, '&'); + }; + $.extend({ // loaded files list - to protect against loading existed file again (by PGA) @@ -50,7 +54,7 @@ }); } - return (this._ondemand_loaded_list[scriptUrl] != undefined); + return (this._ondemand_loaded_list[decodePath(scriptUrl)] != undefined); }, requireCss : function(styleUrl, media){ @@ -89,10 +93,10 @@ for(var i=0;ijavascript, $this->blocked) as $file => $dummy) { $path = $this->path_for_file($file); - if($path) $jsRequirements[] = $path; + if($path) { + $jsRequirements[] = str_replace(',', '%2C', $path); + } } $response->addHeader('X-Include-JS', implode(',', $jsRequirements)); foreach(array_diff_key($this->css,$this->blocked) as $file => $params) { $path = $this->path_for_file($file); - if($path) $cssRequirements[] = isset($params['media']) ? "$path:##:$params[media]" : $path; + if($path) { + $path = str_replace(',', '%2C', $path); + $cssRequirements[] = isset($params['media']) ? "$path:##:$params[media]" : $path; + } } $response->addHeader('X-Include-CSS', implode(',', $cssRequirements));