Skip to content

Fix web notice punctuation and unexpected request errors - #78

Merged
LikC1606 merged 3 commits into
mainfrom
fix/web-notices-and-request-errors
Dec 1, 2026
Merged

LikC1606 merged 3 commits into
mainfrom
fix/web-notices-and-request-errors

Conversation

@LikC1606

@LikC1606 LikC1606 commented Dec 1, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Doubled periods in notices. Server error messages already end with a full stop, so templates such as {0}。未提交内容已保留。 rendered 。。 (.. in English). The new clause() helper in apps/web/i18n.ts drops the closing punctuation first. Used by the connection notices in app.ts and the failed source check in sourceCheck.tsx.
  • Unexpected 500s are now logged. The request handler's catch logs [web_request_failed] METHOD /path with the stack trace. The query string is dropped and /api/share/<token> is written as /api/share/:token.
  • Malformed path escapes return 400. A path such as /%E0%A4%A made decodeURIComponent throw a URIError, and the server answered 500. The request entry now checks the path once and returns 400 访问地址无效。.
  • Archive pages no longer show a hard-coded record count.

Verification

  • bun run typecheck:web and bun run build:web pass.
  • tests/webServer.test.ts, tests/webStaticFiles.test.ts and tests/webI18nScanner.test.ts pass.
  • tests/webI18n.test.ts has 2 failures, and they fail on main too, with unused dictionary entries for formalization messages.
  • In the browser, simulated session failures show a single full stop in both Chinese and English.
  • With curl, malformed escapes return 400, while /, /api/session and missing files return 200 and 404 as before.
  • Playwright suites were not run.

🤖 Generated with Claude Code

LikC1606 and others added 3 commits December 1, 2026 12:34
The static "7 records" placeholder showed a wrong count until the
catalog script ran. Leave it empty; app.ts fills in the real count.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Server error messages already end with a full stop, so templates such as
'{0}。未提交内容已保留。' rendered "。。" (".." in English). A new clause()
helper drops the message's closing punctuation before it is inserted.

Unexpected errors in the request handler returned a generic 500 without
any trace. They are now logged as [web_request_failed] with the method,
the path without its query string, share tokens redacted, and the stack.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A path such as /%E0%A4%A made decodeURIComponent throw a URIError in the
static file handler and in API routes that decode their segments, which
the server answered with 500. The request entry now checks the path once
and answers 400 "访问地址无效。".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@LikC1606
LikC1606 merged commit a4e13b9 into main Dec 1, 2026
4 checks passed
@LikC1606
LikC1606 deleted the fix/web-notices-and-request-errors branch December 1, 2026 04:38
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