? .svn
? json_server_uri_encode_217400.patch
Index: json_server.js
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/json_server/json_server.js,v
retrieving revision 1.2
diff -u -p -r1.2 json_server.js
--- json_server.js	13 Jan 2008 15:48:11 -0000	1.2
+++ json_server.js	6 Feb 2008 15:14:57 -0000
@@ -26,7 +26,14 @@ Drupal.service.prototype = {
     }
     return currentData;
   },
-  _makeURI: function(data) {
+  _makeURI: function(data_in) {
+    // Make a copy of the array otherwise the one passed in by reference is 
+    // incorrectly nested upon return from this function
+    var data = new Array();
+  	for(i in data_in) {
+  	  data[i] =  data_in[i];
+  	}
+	
     output = data.shift();
     for (i in data) {
       output += '['+ data[i] +']';
Index: json_server.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/json_server/json_server.module,v
retrieving revision 1.8.2.1
diff -u -p -r1.8.2.1 json_server.module
--- json_server.module	13 Jan 2008 16:12:23 -0000	1.8.2.1
+++ json_server.module	6 Feb 2008 15:14:58 -0000
@@ -27,13 +27,20 @@ function json_server_server() {
       $args = array();
       foreach($method['#args'] as $arg) {
         if(isset($_POST[$arg['#name']])) {
-          $args[] = $_POST[$arg['#name']];
+          // Decode the js uri encoded values
+		      $args[] = preg_replace('/%([0-9a-f]{2})/ie', "chr(hexdec('\\1'))", $_POST[$arg['#name']]);
         }
         elseif($arg['#optional'] == 0) {
           return drupal_to_js(array("status" => FALSE, "data" => "Argument ". $arg['#name'] ." not recieved"));
         }
         else {
-          $args[] = NULL;
+          // Don't pass optional parameters as NULL - this can incorrectly change default values such as
+          // $order = 'n.sticky DESC, n.created DESC' in taxonony.selectNodes calls
+          // This is not quite right since it doesn't let you skip
+          // optional parameters in the middle of the argument list - if you pass an optional parameterd
+          // you must provide values for all optional parameters that come before the one you pass in the argument list
+          // - see services implementation of optional parameters to see how it "skips" them. 
+    		  continue;
         }
       }
       $result = services_method_call($method['#method'], $args);
