fix(cases): show the real reason when Link Existing rejects a case

POST /api/cases/link passed a fixed 'Invalid request body' to parseBody, which replaced the
schema's own message, so a bad name and a bad folder path (a leading ~, a character a session
working directory cannot have) looked the same. Drop the override so the first validation
issue is returned.
This commit is contained in:
Devvyn committed 2026-10-10 13:50:04 +08:00
1 parent 3d59e59e37
commit 0ae679553b
3 files changed
+25 -1

No files matched your search

+1 -1
View File
@@ -1536,7 +1536,7 @@ export function registerCaseRoutes(app: FastifyInstance, ctx: EventPort & Config
// admin-only in multi-user mode (mirrors host CRUD + the admin-only GET listing).
const denied = adminOnly(req, reply);
if (denied) return denied;
const { name, path: folderPath } = parseBody(LinkCaseSchema, req.body, 'Invalid request body');
const { name, path: folderPath } = parseBody(LinkCaseSchema, req.body);
// Expand ~ to home directory
const expandedPath = folderPath.startsWith('~') ? join(homedir(), folderPath.slice(1)) : folderPath;