$location issue for decoded and unencoded urls #16100
Description
I'm submitting a ...
- bug report
- feature request
- other (Please do not submit support requests here (see above))
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