-
Notifications
You must be signed in to change notification settings - Fork 27.4k
$location issue for decoded and unencoded urls #16100
Comments
@gkalpak you mean (from your comment) doing something such as |
@jbedard, I didn't think through the implementation details. I was referring to the end result 😁 |
Calls to `$browser.url` now normalize the inputted URL ensuring multiple calls only differing in formatting do not force a browser `pushState`. Normalization is done the same as the browser location URL and may differ per browser and may be changed by browsers. Today no browsers fully normalize URLs so this does not fix all instances of this issue. See angular#16100 Closes angular#16606
Calls to `$browser.url` now normalize the inputted URL ensuring multiple calls only differing in formatting do not force a browser `pushState`. Normalization is done the same as the browser location URL and may differ per browser and may be changed by browsers. Today no browsers fully normalize URLs so this does not fix all instances of this issue. See #16100 Closes #16606
Calls to `$browser.url` now normalize the inputted URL ensuring multiple calls only differing in formatting do not force a browser `pushState`. Normalization is done the same as the browser location URL and may differ per browser and may be changed by browsers. Today no browsers fully normalize URLs so this does not fix all instances of this issue. See #16100 Closes #16606
We've partially fixed this using the browser I implemented a POC to do that normalization manually, however we decided this is too big of a change at this point. FYI 15 of the the tested added in that commit currently fail in chrome. For these reasons we are going to put this in a "wont fix" state. |
I'm submitting a ...
Current behavior:
Hi guys.
After a discussion in a PR that I've created to fix an error in $location service for url that contains apostrophes @gkalpak notice that potencially apostrophes in url is not the main problem instead the problem is using decoded and undecoded urls.
see the PR for more details. #16098
Expected / new behavior:
undecoded and decoded url should work using $location service
Angular version: 1.x.
Browser: all
Anything else:
How to fix it
In src/ng/browser.js there is a function fireStateOrUrlChange which has this validation
if (lastBrowserUrl === self.url() && prevLastHistoryState === cachedState) {{
return;
}
The main problem seems to be that we are comparing self.url() to lastBrowserUrl, but lastBrowserUrl can be set from different sources, not always with the same encoding/decoding
The text was updated successfully, but these errors were encountered: