fix: validate parseInt result in getTokenFromUrl - #558
Open
dajiaohuang wants to merge 8 commits into
Open
Conversation
- Remove redundant else branch that was overwriting acc[type] with the same value - Fix mutable default argument by creating requestOptions object fresh each time - Properly merge user-provided hubRequestOptions with default api_key header
Create fresh requestOptions object each time to avoid shared mutable default. Properly merge user-provided hubRequestOptions with default api_key header.
Create fresh requestOptions object each time to avoid shared mutable default. Properly merge user-provided hubRequestOptions with default api_key header.
- Fix mutable default argument by using empty object as default - Add missing api_key header when using default hub URL
When using the default hub URL, user-provided hubRequestOptions (like cache, credentials, etc.) were being completely lost. Now properly merges user options with the default api_key header.
parseInt could return NaN for invalid chainId strings without any indication of error. Now validates and throws an error if chainId is not a valid number.
|
@dajiaohuang is attempting to deploy a commit to the Discove Team on Vercel. A member of the Team first needs to authorize it. |
| fallbackToCustodyAddress = true, | ||
| hubHttpUrl = DEFAULT_HUB_API_URL, | ||
| hubRequestOptions = { | ||
| headers: { |
Author
|
Addressed the current review feedback in the latest commit. The user-data reducer now stores the first value for each type and replaces it only when a newer timestamp is seen, so first-seen fields are no longer lost. Validation: git diff --check passed. The local checkout has no Yarn binary/dependencies, so the package test suite could not run here. |
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.
Summary
修复
getTokenFromUrl函数中parseInt可能返回NaN的问题。问题
如果
chainId不是有效的数字字符串(如 "abc"),parseInt(chainId)会返回NaN,但这个NaN会被直接返回而没有任何错误提示。代码变更
Fix
现在会验证
parseInt的结果,如果返回NaN则抛出错误。