You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The pathParse function in RescriptReactRouter.res currently treats single slash and double slash URLs identically, which causes routing conflicts and prevents proper URL differentiation. #145
// 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