Skip to content

fix(route/zsxq): fix topic link precision loss and missing group_id in URL#21475

Open
pku-zhb wants to merge 2 commits intoDIYgod:masterfrom
pku-zhb:fix/zsxq-topic-id-precision
Open

fix(route/zsxq): fix topic link precision loss and missing group_id in URL#21475
pku-zhb wants to merge 2 commits intoDIYgod:masterfrom
pku-zhb:fix/zsxq-topic-id-precision

Conversation

@pku-zhb
Copy link
Copy Markdown

@pku-zhb pku-zhb commented Mar 22, 2026

Involved Issue / 该 PR 相关 Issue

N/A - bug discovered during self-hosted usage

Example for the Proposed Route(s) / 路由地址示例

/zsxq/group/88855458825252
/zsxq/group/88855458825252/digests

Description

The zsxq (知识星球) route generates broken topic links due to two issues:

1. JavaScript Number precision loss on topic_id

topic_id values from the zsxq API are 17+ digit integers, which exceed Number.MAX_SAFE_INTEGER (2^53 - 1). When JSON.parse() processes these values, precision is silently lost (e.g., last digits get corrupted), resulting in links pointing to non-existent topics.

2. Missing group_id in topic URL

The current URL template is https://wx.zsxq.com/topic/{topic_id}, but the correct format is https://wx.zsxq.com/group/{group_id}/topic/{topic_id}. Without the group_id path segment, the link redirects to an error page.

Fix

  1. Precision fix: Changed responseType to 'text' and pre-process raw JSON to convert large integer ID fields to strings before JSON.parse().
  2. URL fix: Updated URL template to include group_id.
  3. Type fix: Updated topic_id, group_id, user_id types from number to number | string.

New RSS Route Checklist / 新 RSS 路由检查表

  • Bug fix for existing route / 现有路由的 Bug 修复
  • Date and time - Parsed (no change)

Evian added 2 commits March 22, 2026 15:19
…n URL

- topic_id values (17+ digits) exceed Number.MAX_SAFE_INTEGER, causing
  precision loss when parsed by JSON.parse (e.g., 82811428122848582
  becomes 82811428122848580), resulting in broken topic links.
- Topic URLs were missing the group_id path segment, causing 404 errors
  on the zsxq website.

Fix: Pre-process raw JSON response to convert large integer ID fields
to strings before JSON.parse. Also update the URL template to include
group_id: /group/{group_id}/topic/{topic_id}
@github-actions github-actions bot added the route label Mar 22, 2026
@github-actions
Copy link
Copy Markdown
Contributor

Please use actual values in routes section instead of path parameters.
请在 routes 部分使用实际值而不是路径参数。

@github-actions github-actions bot added the auto: route no found Automated test failed due to route can not be found in PR description body label Mar 22, 2026
@github-actions
Copy link
Copy Markdown
Contributor

Auto Review

No clear rule violations found in the current diff.

@github-actions github-actions bot added auto: not ready to review Users can't get the RSS feed output according to automated testing results and removed auto: route no found Automated test failed due to route can not be found in PR description body labels Mar 22, 2026
@github-actions
Copy link
Copy Markdown
Contributor

Successfully generated as following:

http://localhost:1200/zsxq/group/88855458825252 - Failed ❌
HTTPError: Response code 503 (Service Unavailable)

Error Message:<br/>ConfigNotFoundError: 该 RSS 源由于配置不正确而被禁用:令牌丢失。
Route: /zsxq/group/:id/:scope?
Full Route: /zsxq/group/88855458825252
Node Version: v24.14.0
Git Hash: 8045bbb0
http://localhost:1200/zsxq/group/88855458825252/digests - Failed ❌
HTTPError: Response code 503 (Service Unavailable)

Error Message:<br/>ConfigNotFoundError: 该 RSS 源由于配置不正确而被禁用:令牌丢失。
Route: /zsxq/group/:id/:scope?
Full Route: /zsxq/group/88855458825252/digests
Node Version: v24.14.0
Git Hash: 8045bbb0

Comment on lines +19 to +20
const safeBody = (response.body as string).replaceAll(/("(?:topic_id|group_id|user_id|task_id|image_id|category_id)"\s*:\s*)(\d+)/g, '$1"$2"');
const { succeeded, code, resp_data } = JSON.parse(safeBody) as T;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use json-bigint instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

auto: not ready to review Users can't get the RSS feed output according to automated testing results route

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants