From 3d6dff44f33b192a7fa007bfda5e44574fadc6e1 Mon Sep 17 00:00:00 2001 From: Igor Minar Date: Tue, 25 Feb 2014 22:59:31 -0800 Subject: revert: fix($location): parse query string when path is empty in hashbang mode This reverts commit cad717b1171affc3d540cea372576c70b0cb2295. This change causes regressions in existing code and after closer inspection I realized that it is trying to fix an issue that is should not be considered a valid issue. The location service was designed to work against either "hash" part of the window.location when in the hashbang mode or full url when in the html5 mode. This change tries to merge the two modes partially, which is not right. One reason for this is that the search part of window.location can't be modified while in the hashbang mode (a browser limitation), so with this change part of the search object should be immutable and read-only which will only cause more confusion. Relates to #5964 --- src/ng/location.js | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/ng/location.js b/src/ng/location.js index 85f780e2..9bb4d417 100644 --- a/src/ng/location.js +++ b/src/ng/location.js @@ -178,11 +178,6 @@ function LocationHashbangUrl(appBase, hashPrefix) { throw $locationMinErr('ihshprfx', 'Invalid url "{0}", missing hash prefix "{1}".', url, hashPrefix); } - - if (withoutHashUrl === '' && withoutBaseUrl.charAt(0) === '?') { - withoutHashUrl = withoutBaseUrl; - } - parseAppUrl(withoutHashUrl, this, appBase); this.$$path = removeWindowsDriveName(this.$$path, withoutHashUrl, appBase); @@ -233,14 +228,10 @@ function LocationHashbangUrl(appBase, hashPrefix) { */ this.$$compose = function() { var search = toKeyValue(this.$$search), - hash = this.$$hash ? '#' + encodeUriSegment(this.$$hash) : '', - url = ''; + hash = this.$$hash ? '#' + encodeUriSegment(this.$$hash) : ''; this.$$url = encodePath(this.$$path) + (search ? '?' + search : '') + hash; - if (this.$$url) { - url = this.$$path ? hashPrefix + this.$$url : this.$$url; - } - this.$$absUrl = appBase + url; + this.$$absUrl = appBase + (this.$$url ? hashPrefix + this.$$url : ''); }; this.$$rewrite = function(url) { -- cgit v1.2.3