The pathParse function in RescriptReactRouter.res currently treats single slash and double slash URLs identically, which causes routing conflicts and prevents proper URL differentiation.
还没有人认领这个 Issue。
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 65/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 停滞
- 技术栈
- react
- 领域
- frontend
调研方向
从 RescriptReactRouter.res 中的 pathParse 函数开始,检查针对以斜杠分隔的路径的 split 和 filter 逻辑。验证 /analytics-transaction 和 //analytics-transaction 的行为,然后确认结果列表仅对双斜杠 URL 保留开头的空分段。
由索引模型根据 Issue 内容生成。
描述
Current Behavior
// Both URLs return the same parsed result
pathParse("/analytics-transaction") → list{"analytics-transaction"}
pathParse("//analytics-transaction") → list{"analytics-transaction"} // Problem!
Expected Behavior
// URLs should parse differently to enable proper routing
pathParse("/analytics-transaction") → list{"analytics-transaction"}
pathParse("//analytics-transaction") → list{"", "analytics-transaction"} // Should preserve leading empty string
Impact
- Cannot differentiate between /path and //path in routing logic
- Causes "Page Not Found" errors for valid double slash URLs
- Breaks routing patterns that rely on double slash prefixes
Proposed Solution
Modify the filter logic to preserve the first empty string while removing others:
// Current problematic code
raw->Js.String2.split("/")->Js.Array2.filter(item => item->Js.String2.length != 0)->arrayToList
// Proposed fix
let splitArray = raw->Js.String2.split("/")
let filteredArray = []
splitArray->Js.Array2.forEachi((item, index) => {
if item->Js.String2.length != 0 || index == 0 {
filteredArray->Js.Array2.push(item)->ignore
}
})
filteredArray->arrayToList
- 主要语言
- ReScript
- 星标
- 517
- 派生
- 45
- PR 合并指标
- 30 天内没有已合并 PR
贡献指南
这个仓库没有索引到贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
rescript-lang/rescript-react 的其他 Issue
-
难度 3/5 1-2 天 新手友好度 48/100
rescript-lang/rescript-react#152 · 3 个 reaction ·
-
难度 5/5 一周以上 新手友好度 45/100
rescript-lang/rescript-react#147 · 2 条评论 ·
-
难度 5/5 一周以上 新手友好度 25/100
rescript-lang/rescript-react#111 · 3 条评论 ·
-
难度 4/5 3-5 天 新手友好度 25/100
rescript-lang/rescript-react#105 ·
-
难度 5/5 一周以上 新手友好度 25/100
rescript-lang/rescript-react#104 · 1 个 reaction ·
查看 rescript-lang/rescript-react 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 70/100
pastelsky/bundlephobia#1122 ·
-
难度 2/5 1-3 小时 新手友好度 75/100
speaches-ai/speaches#678 ·
-
community first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
难度 1/5 1 小时以内 新手友好度 95/100
-
难度 2/5 1-3 小时 新手友好度 70/100
-
bug
难度 2/5 1-3 小时 新手友好度 75/100
jellyfin/jellyfin-web#8540 ·