-
-
Notifications
You must be signed in to change notification settings - Fork 926
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Router fix #2061
Router fix #2061
Conversation
@pygy This doesn't address the part of browsers returning inconsistent results for routes. Just the case of invalid routes. |
@isiahmeadows I'll have to ponder over this... Now Chrome also uses percent encoding for unicode characters, and none encodes Also, I think that @ FremyCompany wants to have |
@pygy To clarify, this only concerns itself with routes like IMHO the easiest workaround if @ FremyCompany wants to just have raw Oddly enough, our support for such percent-encoded routes appears completely undocumented somehow... (search for either |
@isiahmeadows do we need to gracefully fall back if it happens? I don't think that raw We could perhaps make the regexp smarter:
(not sure why the original has a |
@pygy My only thought is that we not crash the app ourselves over something that not even the developers can realistically control. Of course we could also update the regexp, but I'd rather still have the safeguard in place. |
@isiahmeadows having the check is prudent. The regexp above is too broad, However I couldn't test it on the whole range of code points because Edit, actually, when using the correct function ( |
@pygy Thought I'd clarify: I'm not against the idea of also fixing the regexp (I'm actually kind of with you on it). It's just not the subject of this PR. This is purely just defining the fallback mechanism in case we ever miss an edge case and fail to catch the grammar perfectly, for a bit of fault tolerance. |
@isiahmeadows understood. In that case, we might as well do var data = $window.location[fragment]
try {data = data.replace($regexp, decodeURIComponent)} catch(e){} in Note that the correct RegExp is actually
, after stripping white space (I shouldn't code that late, but past a certain point in tiredness I lose the ability to judge my own sleepiness...). The Another thing I wonder: what happens when the page's encoding isn't UTF-8? Is the page encoding used to extract percent-encoded characters? |
I'm okay with that, if you prefer that over the existing "go to default".
Should have exactly zero impact on the issue. It might affect how the page itself is interpreted, but not the URL. |
@pygy Regarding the serialization issue:
|
@isiahmeadows Chrome now works like Firefox and Safari. Edge still behaves like it did two years ago when I wrote the #881 (comment) table. For IE, we can emulate URL by creating a dummy |
@pygy Does the |
I only tested Edit: do you specifically want to see how |
@pygy I need you to test both, so I know if they deviate or not. If they do, then we can't use it for feature-testing double-escaping. |
So, I just tried this. In Edge, nothing is percent encoded. In all other browsers, the The Latin 1 thing is new, I wonder if someone, somewhere is trolling me. Edit: another one with
FFFFFFFUUUUUUUUUUUU, and I'm mincing my words. Edit2: Thankfully the Latin 1 thing seems to be limited to Flems. @porsager any idea of what could cause this? Edit3: chrome using percent encoding in the hash is quite recent. I have an old alt-Chromium installed (v58) that still has the hash non-encoded. In the new version the hash part of the location bar ends up percent encoded whereas the pathname and the search parts don't. |
@pygy it appears to be because the flems runtime html doesn't have I suppose it would be a good idea adding it to production as well? (just want to be sure what the most correct behavior/expectation is) |
So, the HTML page encoding affects the way percent encoding works in odd ways, even though it shouldn't according to the spec. Thanks @porsager for the diagnostic and the quick fix :-) |
You're welcome... I've been burned by this before, so was the first thing I tried out :P I've added the fix to flems.io as well now.. |
@pygy Does the above discussion block this PR from getting merged? |
@isiahmeadows the Latin-1 stuff, no, but I'd rather have the |
Okay. I'll see about updating it once I have a chance. |
c97be14
to
0fe0fd1
Compare
@pygy Updated. |
@pygy Ping? |
@isiahmeadows I think that the try/catch block in I'll be mostly offline for the next few days (back on Thursday at worse). |
0fe0fd1
to
0a5ead3
Compare
Done. |
closed in favour of #2743 |
Description
Motivation and Context
Fixes part of #2060, and needs backported.
The original bug seems to make a case for security with this, but I doubt exploiting the bug could do any more than just play a practical joke on people.
How Has This Been Tested?
Added a few new tests on both the API and router service
Types of changes
Checklist:
docs/change-log.md