他人のpublicなクリップを取得できない問題を修正

This commit is contained in:
syuilo 2020-11-15 17:32:29 +09:00
parent 385776dc0f
commit 17cc996288
2 changed files with 8 additions and 2 deletions

View file

@ -30,12 +30,15 @@ export default define(meta, async (ps, me) => {
// Fetch the clip
const clip = await Clips.findOne({
id: ps.clipId,
userId: me.id,
});
if (clip == null) {
throw new ApiError(meta.errors.noSuchClip);
}
if (!clip.isPublic && (clip.userId !== me.id)) {
throw new ApiError(meta.errors.noSuchClip);
}
return await Clips.pack(clip);
});