Skip to content

Robustness polish: several low-severity correctness/UX fixes #116

Description

@Bidrift

Severity: Low — a bundle of small, independent fixes.

  1. Unhandled JSON.parse on malformed bodyfeedback/route.ts:5 and error/route.ts:5 call await request.json() outside try/catch → unhandled 500 instead of 400 on a non-JSON body. (The arrest-calculator route does this correctly and is a good model.)
  2. Discord field overflow drops large error reportserror/route.ts:22-27: a big error/componentStack exceeds Discords 1024-char field limit → 400 → the client error is lost. Truncate to ~1000 chars.
  3. [slug] route weak validationpaperwork-generators/[slug]/route.ts: formType cast without an allowlist; formId/groupId may contain /; the slug path segment is parsed but unused. Restrict to [A-Za-z0-9_-]+.
  4. setFormData merges instead of replacespaperwork-store.ts:48-53: stale top-level keys from an earlier submit can survive into a later render. onSubmit already assembles the full payload, so replace.
  5. Analytics opt-out needs a reloadmatomo.tsx:14-32: toggling the Privacy switch does not stop the already-initialized tracker until a full reload. Subscribe to the store and call Matomo optUserOut/forgetUserOptOut reactively.
  6. Typo classnamelog-parser-page.tsx:147: "... cursor pointer" should be cursor-pointer (the pointer cursor never applies).

Filed from a code audit of the current master. Line numbers are approximate.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions