diff options
| author | Manuel Braun | 2013-03-07 13:36:38 +0100 |
|---|---|---|
| committer | Misko Hevery | 2013-03-15 21:19:31 -0700 |
| commit | 3a81dd8bddbade81c4c9f734813458d0d969a4bf (patch) | |
| tree | 36467ec2e4b3c3fa590f825842ea8d13ad9d7873 | |
| parent | df9bff13b2bf8376428cd28fce472aeee07c4bbe (diff) | |
| download | angular.js-3a81dd8bddbade81c4c9f734813458d0d969a4bf.tar.bz2 | |
fix($location): parse FirefoxOS packaged app urls
FirefoxOS uses special URLs like
app://{d0419af1-8b42-41c5-96f4-ef4179e52315}/index.html for packaged Apps.
Closes #2112
| -rw-r--r-- | src/ng/location.js | 2 | ||||
| -rw-r--r-- | test/ng/locationSpec.js | 13 |
2 files changed, 14 insertions, 1 deletions
diff --git a/src/ng/location.js b/src/ng/location.js index e6f629e5..3196b1d5 100644 --- a/src/ng/location.js +++ b/src/ng/location.js @@ -1,6 +1,6 @@ 'use strict'; -var URL_MATCH = /^([^:]+):\/\/(\w+:{0,1}\w*@)?([\w\.-]*)(:([0-9]+))?(\/[^\?#]*)?(\?([^#]*))?(#(.*))?$/, +var URL_MATCH = /^([^:]+):\/\/(\w+:{0,1}\w*@)?(\{?[\w\.-]*\}?)(:([0-9]+))?(\/[^\?#]*)?(\?([^#]*))?(#(.*))?$/, PATH_MATCH = /^([^\?#]*)?(\?([^#]*))?(#(.*))?$/, HASH_MATCH = PATH_MATCH, DEFAULT_PORTS = {'http': 80, 'https': 443, 'ftp': 21}; diff --git a/test/ng/locationSpec.js b/test/ng/locationSpec.js index c40d5323..bf91c250 100644 --- a/test/ng/locationSpec.js +++ b/test/ng/locationSpec.js @@ -676,6 +676,19 @@ describe('$location', function() { expect(match[8]).toBe('foo'); expect(match[10]).toBe('bar'); }); + + it('should parse FFOS app:// urls', function() { + var match = URL_MATCH.exec('app://{d0419af1-8b42-41c5-96f4-ef4179e52315}/path'); + + expect(match[1]).toBe('app'); + expect(match[3]).toBe('{d0419af1-8b42-41c5-96f4-ef4179e52315}'); + expect(match[5]).toBeFalsy(); + expect(match[6]).toBe('/path'); + expect(match[8]).toBeFalsy(); + + match = URL_MATCH.exec('app://}foo{') + expect(match).toBe(null); + }); }); |
