Skip to content

Commit d0cbe81

Browse files
fix(skills): reject whitespace-only title and instructions in POST /skills (#377)
Co-authored-by: David McKay <david@copilotkit.ai>
1 parent 455dcae commit d0cbe81

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

‎server/src/plugins/routes.ts‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -574,7 +574,7 @@ export function createPluginRoutes(
574574
global?: boolean;
575575
tools?: unknown;
576576
} | null;
577-
if (!body?.slug || !body.title || !body.instructions) {
577+
if (!body?.slug || !body?.title?.trim() || !body?.instructions?.trim()) {
578578
return context.json(
579579
{ error: "A slug, a title and instructions are required." },
580580
400,
@@ -617,9 +617,9 @@ export function createPluginRoutes(
617617
try {
618618
await store.installSkill({
619619
slug: body.slug,
620-
title: body.title,
620+
title: body.title.trim(),
621621
summary: body.summary ?? "",
622-
instructions: body.instructions,
622+
instructions: body.instructions.trim(),
623623
ownerUserId: body.global ? null : actor.id,
624624
...(tools === undefined ? {} : { tools }),
625625
by: actorEmail(context),

0 commit comments

Comments
 (0)