-
Notifications
You must be signed in to change notification settings - Fork 27.5k
LocationHashbangUrl.$$compose() creates nonsensical routes out of thin air #3141
Comments
Probably related to #2833 |
also related/same issue as #2860 |
trying to follow the thread amongst all these related issues is tough... but fwiw, in my app when using v1.1.5 these two routes are treated the same when entered directly into the browser's address bar:
likewise and more problematically, this route:
ends up being interpreted as:
clicking down into the above url works... refreshing the browser or using a bookmark does not. downgrading to v1.1.4 fixed it for me. |
I gave up and went to 1.0.7 or whatever's "stable." This is just too horribly broken to mess with. |
I fixed this in my custom repo by adding the last line as follows: function LocationHashbangUrl(appBase, hashPrefix) {
var appBaseNoFile = stripFile(appBase);
appBaseNoFile = appBase; It doesn't seem like we should be using appBaseNoFile for LocationHashbangUrl. |
Since I use
I changed the
and in the
When using With
When loading the above link in IE9 or less, the url becomes: I hope this helps someone who is also looking to fix this. |
@oncomeme is this issue still biting you in 1.2.x? We refactored the underlying url parsing logic in 1.2. I'm closing this issue, but feel free to reopen. If you do need to reopen, can you provide a plunker demonstrating the issue? |
No idea. Can't upgrade any time soon. |
Yes, this is confirmed to be fixed |
In short, in 1.1.5, if your initial route is basically no route at all (pushState disabled and no hash present), Angular makes one up, redirects to it, and destroys
window.location
.The first thing LocationHashbangUrl's constructor does is create an
appBaseNoFile
variable and assign it the output ofstripFile(appBase)
.If our appBase was something like
http://localhost:3000/some/resource/path
then
appBaseNoFile
is going to containhttp://localhost:3000/some/resource/
.Later on, $$parse does this bit:
angular.js/src/ng/location.js
Line 159 in 8073940
and
withoutBaseUrl
now containspath
.Shortly thereafter, it essentially copies this value to another variable:
withoutHashUrl
It then calls
matchAppUrl
passing it thiswithoutHashUrl
which remains unchanged.Eventually we get to
$$compose
which decides its$$url
and$$path
variables should contain/path
and suddenly$$absUrl
contains the completely invalid routehttp://localhost:3000/some/resource/path#/path
Which the window's location is set to by the location provider, causing all kinds of problems.
If Angular absolutely must create a route in order to function, it should at least be a valid one, like
/#/
rather than the last path component repeated for no apparent reason.The text was updated successfully, but these errors were encountered: