#9651 NORM 1.5-F11: Accept JSON in Journal Entry Bundle metadata (was: Minor corruption on Journal Entry Bundles from Sugar 0.84)

Zarro Boogs per Child bugtracker at laptop.org
Thu Nov 12 09:46:15 EST 2009


#9651: Accept JSON in Journal Entry Bundle metadata
---------------------------------------+------------------------------------
           Reporter:  martin.langhoff  |       Owner:  martin.langhoff
               Type:  defect           |      Status:  assigned       
           Priority:  normal           |   Milestone:  1.5-F11        
          Component:  sugar            |     Version:  not specified  
         Resolution:                   |    Keywords:                 
        Next_action:  diagnose         |    Verified:  0              
Deployment_affected:                   |   Blockedby:                 
           Blocking:                   |  
---------------------------------------+------------------------------------
Changes (by martin.langhoff):

  * component:  school server => sugar


Comment:

 Re-titling. The problem stems from the aforementioned forward slashes.
 Sugar switched parser from the (correctly) tolerant JSON parser to the
 strict CJSON parser.

 Given that JEB is an exchange format, and will sometimes be written by an
 external system (ie: Moodle), accepting JSON compliant input is the right
 move. Patch attached.

 This is fallout from
 http://git.sugarlabs.org/projects/sugar/repos/mainline/commits/ee4535c98ae74347e7072909d49dcf8a5e16ca7b
 - IMO the other codepaths are also used to read externally produced data
 (ie:'buddies' is nested in the JEB metadata) so this may warrant a plain
 revert.

 Attached is my patch which effectively reverts the changes only in the JEB
 parser. It has been tested and works correctly with JEBs produced by
 Moodle.

 To help this along, I was hoping to add a patch to the Moodle side as well
 (to be stricter in the escaping) but the JSON writer in PHP 5.2 has no
 knobs for this. PHP 5.3 seems to have some more knobs, but none apply to
 slashes.

-- 
Ticket URL: <http://dev.laptop.org/ticket/9651#comment:3>
One Laptop Per Child <http://laptop.org/>
OLPC bug tracking system


More information about the Bugs mailing list