mirror of
https://git.joinsharkey.org/Sharkey/Sharkey.git
synced 2024-11-23 05:23:09 +02:00
fix(server): notes/createで、fileIdsと見つかったファイルの数が異なる場合はエラーにする (#9911)
* fix(server): notes/createで、fileIdsと見つかったファイルの数が異なる場合はエラーにする * NO_SUCH_FILE
This commit is contained in:
parent
5c989ed18f
commit
e4336f5b76
1 changed files with 10 additions and 0 deletions
|
@ -79,6 +79,12 @@ export const meta = {
|
||||||
code: 'YOU_HAVE_BEEN_BLOCKED',
|
code: 'YOU_HAVE_BEEN_BLOCKED',
|
||||||
id: 'b390d7e1-8a5e-46ed-b625-06271cafd3d3',
|
id: 'b390d7e1-8a5e-46ed-b625-06271cafd3d3',
|
||||||
},
|
},
|
||||||
|
|
||||||
|
noSuchFile: {
|
||||||
|
message: 'Some files are not found.',
|
||||||
|
code: 'NO_SUCH_FILE',
|
||||||
|
id: 'b6992544-63e7-67f0-fa7f-32444b1b5306',
|
||||||
|
},
|
||||||
},
|
},
|
||||||
} as const;
|
} as const;
|
||||||
|
|
||||||
|
@ -207,6 +213,10 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
|
||||||
.orderBy('array_position(ARRAY[:...fileIds], "id"::text)')
|
.orderBy('array_position(ARRAY[:...fileIds], "id"::text)')
|
||||||
.setParameters({ fileIds })
|
.setParameters({ fileIds })
|
||||||
.getMany();
|
.getMany();
|
||||||
|
|
||||||
|
if (files.length !== fileIds.length) {
|
||||||
|
throw new ApiError(meta.errors.noSuchFile);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let renote: Note | null = null;
|
let renote: Note | null = null;
|
||||||
|
|
Loading…
Reference in a new issue