mirror of
https://github.com/sim1222/misskey.git
synced 2025-08-04 07:26:29 +09:00
[API] Fix: Validate ids
This commit is contained in:
@ -28,6 +28,11 @@ module.exports = (params, user) =>
|
||||
return rej('user_id is required');
|
||||
}
|
||||
|
||||
// Validate id
|
||||
if (!mongo.ObjectID.isValid(userId)) {
|
||||
return rej('incorrect user_id');
|
||||
}
|
||||
|
||||
// 自分自身
|
||||
if (user._id.equals(userId)) {
|
||||
return rej('followee is yourself');
|
||||
|
@ -27,6 +27,11 @@ module.exports = (params, user) =>
|
||||
return rej('user_id is required');
|
||||
}
|
||||
|
||||
// Validate id
|
||||
if (!mongo.ObjectID.isValid(userId)) {
|
||||
return rej('incorrect user_id');
|
||||
}
|
||||
|
||||
// Check if the followee is yourself
|
||||
if (user._id.equals(userId)) {
|
||||
return rej('followee is yourself');
|
||||
|
Reference in New Issue
Block a user