File tree Expand file tree Collapse file tree 2 files changed +14
-9
lines changed Expand file tree Collapse file tree 2 files changed +14
-9
lines changed Original file line number Diff line number Diff line change @@ -1481,8 +1481,9 @@ describe('Cloud Code', () => {
14811481
14821482 it ( 'beforeSave should not sanitize database' , async done => {
14831483 let count = 0 ;
1484- Parse . Cloud . beforeSave ( 'CloudIncrementNested' , ( ) => {
1484+ Parse . Cloud . beforeSave ( 'CloudIncrementNested' , req => {
14851485 count += 1 ;
1486+ expect ( typeof req . object . get ( 'objectField' ) . number ) . toBe ( 'number' ) ;
14861487 } ) ;
14871488
14881489 const obj = new Parse . Object ( 'CloudIncrementNested' ) ;
Original file line number Diff line number Diff line change @@ -1558,15 +1558,19 @@ RestWrite.prototype.buildUpdatedObject = function (extraData) {
15581558 const updatedObject = triggers . inflate ( extraData , this . originalData ) ;
15591559 Object . keys ( this . data ) . reduce ( function ( data , key ) {
15601560 if ( key . indexOf ( '.' ) > 0 ) {
1561- // subdocument key with dot notation ('x.y':v => 'x':{'y':v})
1562- const splittedKey = key . split ( '.' ) ;
1563- const parentProp = splittedKey [ 0 ] ;
1564- let parentVal = updatedObject . get ( parentProp ) ;
1565- if ( typeof parentVal !== 'object' ) {
1566- parentVal = { } ;
1561+ if ( typeof data [ key ] . __op === 'string' ) {
1562+ updatedObject . set ( key , data [ key ] ) ;
1563+ } else {
1564+ // subdocument key with dot notation { 'x.y': v } => { 'x': { 'y' : v } })
1565+ const splittedKey = key . split ( '.' ) ;
1566+ const parentProp = splittedKey [ 0 ] ;
1567+ let parentVal = updatedObject . get ( parentProp ) ;
1568+ if ( typeof parentVal !== 'object' ) {
1569+ parentVal = { } ;
1570+ }
1571+ parentVal [ splittedKey [ 1 ] ] = data [ key ] ;
1572+ updatedObject . set ( parentProp , parentVal ) ;
15671573 }
1568- parentVal [ splittedKey [ 1 ] ] = data [ key ] ;
1569- updatedObject . set ( parentProp , parentVal ) ;
15701574 delete data [ key ] ;
15711575 }
15721576 return data ;
You can’t perform that action at this time.
0 commit comments