Skip to content

Commit e39fcee

Browse files
committed
fix: prevent internal server error by validating request body
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> AdminForth/1729/internal-server-error-when-i-m
1 parent 30d042a commit e39fcee

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -780,6 +780,9 @@ export default class BulkAiFlowPlugin extends AdminForthPlugin {
780780
method: 'POST',
781781
path: `/plugin/${this.pluginInstanceId}/get_records`,
782782
handler: async ( body ) => {
783+
if (!Array.isArray(body.body?.record)) {
784+
return { records: [] };
785+
}
783786
let records = [];
784787
const primaryKeyColumn = this.resourceConfig.columns.find((col) => col.primaryKey);
785788
records = await this.adminforth.resource(this.resourceConfig.resourceId).list([Filters.IN(primaryKeyColumn.name, body.body.record)]);

0 commit comments

Comments
 (0)