Skip to content

Commit 737eb9d

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 5a20b6b commit 737eb9d

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
@@ -98,6 +98,9 @@ export default class TextCompletePlugin extends AdminForthPlugin {
9898
}
9999

100100
const { record } = body;
101+
if (!record) {
102+
return { completion: [] };
103+
}
101104
const recordNoField = {...record};
102105
delete recordNoField[this.options.fieldName];
103106
let currentVal = record[this.options.fieldName];

0 commit comments

Comments
 (0)