mirror of
https://github.com/zhigang1992/angular.js.git
synced 2026-04-29 13:25:40 +08:00
fix($location): add semicolon to whitelist of delimiters to unencode
Some servers require characters within path segments to contain semicolons, such as `/;jsessionid=foo` in order to work correctly. RFC-3986 includes semicolons as acceptable sub-delimiters inside of path and query, but $location currently encodes semicolons. This can cause an infinite digest to occur since $location is comparing the internal semicolon-encoded url with the semicolon-unencoded url returned from window.location.href, causing Angular to believe the url is changing with each digest loop. This fix adds ";" to the list of characters to unencode after encoding queries or path segments. Closes #5019
This commit is contained in:
@@ -668,16 +668,16 @@ describe('angular', function() {
|
||||
toEqual('asdf1234asdf');
|
||||
|
||||
//don't encode unreserved'
|
||||
expect(encodeUriSegment("-_.!~*'() -_.!~*'()")).
|
||||
toEqual("-_.!~*'()%20-_.!~*'()");
|
||||
expect(encodeUriSegment("-_.!~*'(); -_.!~*'();")).
|
||||
toEqual("-_.!~*'();%20-_.!~*'();");
|
||||
|
||||
//don't encode the rest of pchar'
|
||||
expect(encodeUriSegment(':@&=+$, :@&=+$,')).
|
||||
toEqual(':@&=+$,%20:@&=+$,');
|
||||
|
||||
//encode '/', ';' and ' ''
|
||||
//encode '/' and ' ''
|
||||
expect(encodeUriSegment('/; /;')).
|
||||
toEqual('%2F%3B%20%2F%3B');
|
||||
toEqual('%2F;%20%2F;');
|
||||
});
|
||||
});
|
||||
|
||||
@@ -699,7 +699,7 @@ describe('angular', function() {
|
||||
|
||||
//encode '&', ';', '=', '+', and '#'
|
||||
expect(encodeUriQuery('&;=+# &;=+#')).
|
||||
toEqual('%26%3B%3D%2B%23+%26%3B%3D%2B%23');
|
||||
toEqual('%26;%3D%2B%23+%26;%3D%2B%23');
|
||||
|
||||
//encode ' ' as '+'
|
||||
expect(encodeUriQuery(' ')).
|
||||
|
||||
Reference in New Issue
Block a user