Skip to content

Commit bfdc878

Browse files
committed
fix(beforeSave): Skip Sanitizing Database results
1 parent 568c285 commit bfdc878

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

spec/CloudCode.spec.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1479,6 +1479,23 @@ describe('Cloud Code', () => {
14791479
});
14801480
});
14811481

1482+
it('beforeSave should not sanitize database', async done => {
1483+
let count = 0;
1484+
Parse.Cloud.beforeSave('CloudIncrementNested', () => {
1485+
count += 1;
1486+
if (count === 2) {
1487+
done();
1488+
}
1489+
});
1490+
1491+
const obj = new Parse.Object('CloudIncrementNested');
1492+
obj.set('objectField', { number: 5 });
1493+
await obj.save();
1494+
1495+
obj.increment('objectField.number', 10);
1496+
await obj.save();
1497+
});
1498+
14821499
/**
14831500
* Verifies that an afterSave hook throwing an exception
14841501
* will not prevent a successful save response from being returned

src/RestWrite.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ RestWrite.prototype.runBeforeSaveTrigger = function () {
235235
this.query,
236236
this.data,
237237
this.runOptions,
238-
false,
238+
true,
239239
true
240240
);
241241
} else {

0 commit comments

Comments
 (0)