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
Open
fix(route/zsxq): fix topic link precision loss and missing group_id in URL#21475pku-zhb wants to merge 2 commits intoDIYgod:masterfrom
pku-zhb wants to merge 2 commits intoDIYgod:masterfrom
Conversation
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}
Contributor
|
Please use actual values in |
Contributor
Auto ReviewNo clear rule violations found in the current diff. |
Contributor
|
Successfully generated as following: http://localhost:1200/zsxq/group/88855458825252 - Failed ❌http://localhost:1200/zsxq/group/88855458825252/digests - Failed ❌ |
TonyRL
reviewed
Mar 23, 2026
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; |
Collaborator
There was a problem hiding this comment.
Please use json-bigint instead.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Involved Issue / 该 PR 相关 Issue
N/A - bug discovered during self-hosted usage
Example for the Proposed Route(s) / 路由地址示例
Description
The zsxq (知识星球) route generates broken topic links due to two issues:
1. JavaScript Number precision loss on topic_id
topic_idvalues from the zsxq API are 17+ digit integers, which exceedNumber.MAX_SAFE_INTEGER(2^53 - 1). WhenJSON.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 ishttps://wx.zsxq.com/group/{group_id}/topic/{topic_id}. Without thegroup_idpath segment, the link redirects to an error page.Fix
responseTypeto'text'and pre-process raw JSON to convert large integer ID fields to strings beforeJSON.parse().group_id.topic_id,group_id,user_idtypes fromnumbertonumber | string.New RSS Route Checklist / 新 RSS 路由检查表