Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#4744 closed defect (fixed)

RPC result semibroken in 10834

Reported by: guest Owned by: Adam Peller
Priority: high Milestone: 1.0
Component: RPC Version: 0.9
Keywords: Cc:
Blocked By: Blocking:

Description

was committed change to rpc/JsonService.js in revision 10834

parseResults: function(obj){
			//summary:
			//		parse the result envelope and pass the results back to to
			//		the callback function
			if(!obj){ return; }
			return obj.Result || obj.result || obj.ResultSet || obj;
		}

in case of boolean value "false" as a result this function will return incorrect value - envelope itself instead of "false"

Change History (5)

comment:1 Changed 12 years ago by Adam Peller

Milestone: 1.0
Owner: changed from Dustin Machi to Adam Peller

comment:2 Changed 12 years ago by Adam Peller

Resolution: fixed
Status: newclosed

(In [10862]) Handle false in parseResults. Fixes #4744

comment:3 Changed 12 years ago by guest

Resolution: fixed
Status: closedreopened

still incorrect. In case of response is {result:false}, or {result:null}, or {result:""} parseResults will return response object itself, instead of response only Also, result.result can be null patch below resolved these troubles

Index: rpc/JsonService.js
===================================================================
--- rpc/JsonService.js	(revision 10883)
+++ rpc/JsonService.js	(working copy)
@@ -43,7 +43,13 @@
 			//		parse the result envelope and pass the results back to
 			//		the callback function
 			if(obj === null){ return null; }
-			return obj.Result || obj.result || obj.ResultSet || obj;
+			if (obj.result!=undefined)
+				return obj.result;
+			if (obj.Result!=undefined)
+				return obj.Result;
+			if (obj.ResultSet!=undefined)
+				return obj.ResultSet;
+			return obj;
 		}
 	}
 );

comment:4 Changed 12 years ago by Adam Peller

Resolution: fixed
Status: reopenedclosed

(In [10902]) sorry, didn't understand the original bug report. How's this? (probably close to where we started) Fixes #4744

comment:5 Changed 12 years ago by Adam Peller

(In [10903]) Perhaps this is slightly better. Refs #4744

Note: See TracTickets for help on using tickets.