mirror of
https://git.joinsharkey.org/Sharkey/Sharkey.git
synced 2024-11-24 00:23:09 +02:00
add safety guard to serializers & fix importing uncorrect serializer
This commit is contained in:
parent
26602dcd20
commit
c1fc3b9f6e
3 changed files with 5 additions and 1 deletions
|
@ -4,7 +4,7 @@
|
||||||
import $ from 'cafy';
|
import $ from 'cafy';
|
||||||
import DriveFolder from '../../../models/drive-folder';
|
import DriveFolder from '../../../models/drive-folder';
|
||||||
import { isValidFolderName } from '../../../models/drive-folder';
|
import { isValidFolderName } from '../../../models/drive-folder';
|
||||||
import serialize from '../../../serializers/drive-file';
|
import serialize from '../../../serializers/drive-folder';
|
||||||
import event from '../../../event';
|
import event from '../../../event';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -57,6 +57,8 @@ const self = async (
|
||||||
_post = deepcopy(post);
|
_post = deepcopy(post);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!_post) throw 'invalid post arg.';
|
||||||
|
|
||||||
const id = _post._id;
|
const id = _post._id;
|
||||||
|
|
||||||
// Rename _id to id
|
// Rename _id to id
|
||||||
|
|
|
@ -56,6 +56,8 @@ export default (
|
||||||
_user = deepcopy(user);
|
_user = deepcopy(user);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!_user) return reject('invalid user arg.');
|
||||||
|
|
||||||
// Me
|
// Me
|
||||||
const meId: mongo.ObjectID = me
|
const meId: mongo.ObjectID = me
|
||||||
? mongo.ObjectID.prototype.isPrototypeOf(me)
|
? mongo.ObjectID.prototype.isPrototypeOf(me)
|
||||||
|
|
Loading…
Reference in a new issue