Repository navigation
Conversation
… the page origin EndpointTab 的 DataSourceSelector 选中的 origin 只用于展示代码块, ParamsTableWithForm 从未收到它——测试请求用相对路径构造,axios 解析到页面 origin(window.location.origin)而非选中的数据源。 默认状态下 UI 显示 https://oss-compass.isrc.ac.cn/api/v2/... 而 请求实际打到当前站点后端。 同时移除 ParamsTableWithForm 的三处 debug console.log——其中 console.log(values) 在每次"发送请求"时将用户的 access_token (API 密钥)完整输出到浏览器控制台。 baseUrl 从 EndpointTab 传入并用于 constructUrl。
|
@zjncs is attempting to deploy a commit to the codersett's projects Team on Vercel. A member of the Team first needs to authorize it. |
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
This branch has not been deployed
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.
Problem
Two coupled issues in the API documentation test console (
modules/dataHub):1. Requests go to the page origin, not the selected data source.
EndpointTab'sDataSourceSelectorlets the user pick one of three origins (oss-compass.org / isrc / osslab-pku), but the selected value only feeds the displayed code block.ParamsTableWithFormnever receives it — the test request uses a bare relative path, which axios resolves againstwindow.location.origin. The UI advertiseshttps://oss-compass.isrc.ac.cn/api/v2/...while the request actually hits the current site's backend.2. Debug
console.logleaks the user'saccess_tokenon every request.console.log(values)dumps the complete form values — including the user's API key — to the browser console in production. Plus a per-param debug log block.Fix
baseUrlfromEndpointTabtoParamsTableWithForm; prepend it inconstructUrl.console.logcalls.Verification
EndpointTab.test.tsx(mocked children): assertsParamsTableWithFormreceivesbaseUrl: 'https://oss-compass.isrc.ac.cn'alongsidepath/method— RED before (nobaseUrlprop existed), GREEN after.tsc --noEmit: zero errors in the touched files (pre-existing SVG module-declaration errors elsewhere unchanged).Risk
The test console now actually tests against the origin the user selected — previously it silently tested against whichever site the user was browsing.