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
I really want to use the query string method (i.e. <BrowserRouter basename="?"> described in #435 (comment)) since this gives me browser history without having to add a catch-all rule in the server, but unfortunately the hasBasename function treats the basename as part of a regular expression which causes some problems.
This problem is larger than just my use of it because [.*+()] are all legal URI path characters and have special meaning in regular expressions. The relevant code should probably check that the path startsWith the prefix and that the character following the prefix is one of the intended, something like:
This doesn't deal with the case-insensitivity of percent encoded URIs but then the existing code treats paths as entirely case-insensitive when it shouldn't. I'm not sure if any special handling is required (or desired) for percent encoding.
The text was updated successfully, but these errors were encountered:
Actually as I already explained in the second paragraph you don’t support all URL path names for basename because you don’t support the characters [.*+()] which are all legal URL path name characters.
I’m not sure how my use case is relevant beyond providing context but it is exactly as I described in the opening paragraph of my bug report. I want browser history without having to modify the server; using the query string seems to be the obvious way to get the best of both worlds. Also, the linked issue #435 has further discussion.
I really want to use the query string method (i.e.
<BrowserRouter basename="?">
described in #435 (comment)) since this gives me browser history without having to add a catch-all rule in the server, but unfortunately thehasBasename
function treats thebasename
as part of a regular expression which causes some problems.https://github.com/ReactTraining/history/blob/8d98aec1366b86e3832dbfd7dcc480d1f9a5275c/modules/PathUtils.js#L7-L8
This problem is larger than just my use of it because
[.*+()]
are all legal URI path characters and have special meaning in regular expressions. The relevant code should probably check that the pathstartsWith
the prefix and that the character following the prefix is one of the intended, something like:This doesn't deal with the case-insensitivity of percent encoded URIs but then the existing code treats paths as entirely case-insensitive when it shouldn't. I'm not sure if any special handling is required (or desired) for percent encoding.
The text was updated successfully, but these errors were encountered: