Skip to content

Commit 3289f52

Browse files
authored
feat: verify objectId when create object without data (#634)
1 parent cb5cfed commit 3289f52

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

src/file.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,9 @@ module.exports = function(AV) {
188188
* @return {AV.File} the file object
189189
*/
190190
AV.File.createWithoutData = function(objectId) {
191+
if (!objectId) {
192+
throw new TypeError('The objectId must be provided');
193+
}
191194
var file = new AV.File();
192195
file.id = objectId;
193196
return file;

src/object.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1381,6 +1381,9 @@ module.exports = function(AV) {
13811381
} else {
13821382
throw new Error('class must be a string or a subclass of AV.Object.');
13831383
}
1384+
if (!id) {
1385+
throw new TypeError('The objectId must be provided');
1386+
}
13841387
const object = new _klass();
13851388
object.id = id;
13861389
object._hasData = hasData;

0 commit comments

Comments
 (0)