Skip to content

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

Open
opticon454 wants to merge 1 commit into
Ark0N:masterfrom
opticon454:fix/case-link-validation-message
Open

opticon454 wants to merge 1 commit into
Ark0N:masterfrom
opticon454:fix/case-link-validation-message

Conversation

@opticon454

Copy link
Copy Markdown
Contributor

Problem

Add Case → Link Existing answers every validation failure with "Invalid request body". POST /api/cases/link passes that fixed string to parseBody, which uses it instead of the schema's message, so a bad case name, a path starting with ~ (the route expands ~ later, but the absolute-path rule rejects it first) and a path with a character a session folder cannot have all read the same, with nothing to act on.

Change

Drop the override, so the first validation issue is returned: "Invalid case name format" or "Invalid path: must be absolute, no shell metacharacters or traversal".

Tests

test/routes/case-routes.test.ts: a bad name and a ~/… path each return their own message. The file passes (44), tsc --noEmit clean.

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.
@opticon454
opticon454 force-pushed the fix/case-link-validation-message branch from 5b6337a to 0ae6795 Compare October 10, 2026 06:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant