Skip to content

Commit

Permalink
fix(backend): return error if fileIds are not equal to found ones
Browse files Browse the repository at this point in the history
fix(server): notes/createで、fileIdsと見つかったファイルの数が異なる場合はエラーにする
  • Loading branch information
atsu1125 committed Oct 27, 2024
1 parent 23e6244 commit 228e3b5
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/server/api/endpoints/notes/create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,12 @@ export const meta = {
code: 'CANNOT_RENOTE_DUE_TO_VISIBILITY',
id: 'be9529e9-fe72-4de0-ae43-0b363c4938af',
},

noSuchFile: {
message: 'Some files are not found.',
code: 'NO_SUCH_FILE',
id: 'b6992544-63e7-67f0-fa7f-32444b1b5306',
},
}
};

Expand All @@ -254,6 +260,9 @@ export default define(meta, async (ps, user) => {
userId: user.id
})
))).filter(file => file != null) as DriveFile[];
if (files.length !== fileIds.length) {
throw new ApiError(meta.errors.noSuchFile);
}
}

let renote: Note | undefined;
Expand Down

0 comments on commit 228e3b5

Please sign in to comment.