Redirect to relative path does redirect to wrong path
Hi. I updated router to its latest version 1.26.16 and saw that this code wasn't redirecting to /app/dashboard but to /dashboard.
17 Replies
provincial-silverOP•2y ago
I'm able to build the app, there is no apparent error before running the app
Looks like it redirect to from parent route + to route.
So if I'm doing :
It redirects to /app/child-1 instead of '/app/test/child1'.
In fact, it looks like "./child-1' is doing a redirect like if we were doing '../child-1'
stormy-gold•2y ago
@Tanner Linsley please have a look since you mentioned you fixed something here
stormy-gold•2y ago
This functionality is correct and adheres to the way hrefs work on the web
This was a critical runtime fix that I pushed asap
stormy-gold•2y ago
./ equals ../?stormy-gold•2y ago
The docs will be updated to reflect this change soon along with upgraded types for relative auto complete
stormy-gold•2y ago
so not the same behavior as on a standard shell?
stormy-gold•2y ago
. Is a parent directory identifier, .. is a grandparent and “” is relative
There is some disparity between shell and web I think
Eg, from /a/b, ./ would resolve to a/
stormy-gold•2y ago
can you point me to the documentation / standard etc?
this one? https://www.rfc-editor.org/rfc/rfc3986#section-5.2.4
stormy-gold•2y ago
Not off the top of my head. Just create some vanilla a hrefs and this is how they resolve
Yes this how a hrefs behave
AFAIK
Our interpretations of ./ and ../ were off by one which resulting in relative paths traversing up the directory structure requiring an extra ..
Vscode was autocompleting this correctly to a higher directory than needed creating a big disparity between our interpretation (which was wrong)
I’m not surprised we didn’t catch this earlier because TSR encourages and autocompletes to absolute paths
Introducing full stack and server envs exacerbated this issue into a fully formed WTF lol
So yeah today is fixing day
stormy-gold•2y ago
firefox translates this to http://google.com/foo/hello
and this
results in http://google.com/hello
so I'd say this is exactly how ashell behaves
did you have another test in mind?
stormy-gold•2y ago
I think they behave differently inside of a link than they do as the prefix
stormy-gold•2y ago
prefix? link?
stormy-gold•2y ago
These are just manual <a href> tags I created on this page



stormy-gold•2y ago
This actually does mimic shell, because shell is never really on a "Document"
it's a directory browser
So it makes sense that
. references the directory you are in, since that's the nearest directorystormy-gold•2y ago
VSCode does this as well


stormy-gold•2y ago
I know it's a departure from the beginnings of the library, but if we don't make this change, we'll not only be incorrectly implementing a standard, but we'll also be deviating from pretty normal expectations on the web.
Hang on....
TRAILING SLASH
UGHHGHGHGHGHHGHGH
Apparently a trailing slash makes a difference
So I think this is the issue
So
- Treat every link as if it has a trailing slash
-
. goes to the parent
- .. goes to the grandparent
- ./a and a behave the same (we need to talk about a potential "fromCurrent" option, since links are relative to their parent route, not the entire route)
@Manuel Schiller @Maqui I just pushed a release that should fix thisprovincial-silverOP•2y ago
Thank you Tanner !