Skip to content

Commit a4c84c0

Browse files
authored
fix(beforeSave): Skip Sanitizing Database results (#7003)
* fix(beforeSave): Skip Sanitizing Database results * fix test
1 parent 568c285 commit a4c84c0

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

spec/CloudCode.spec.js

+15
Original file line numberDiff line numberDiff line change
@@ -1479,6 +1479,21 @@ 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+
});
1487+
1488+
const obj = new Parse.Object('CloudIncrementNested');
1489+
obj.set('objectField', { number: 5 });
1490+
await obj.save();
1491+
1492+
obj.increment('objectField.number', 10);
1493+
await obj.save();
1494+
count === 2 ? done() : fail();
1495+
});
1496+
14821497
/**
14831498
* Verifies that an afterSave hook throwing an exception
14841499
* will not prevent a successful save response from being returned

src/RestWrite.js

+1-1
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)