Skip to content

Commit 9945d50

Browse files
committed
fix($location): parse FirefoxOS packaged app urls
FirefoxOS uses special URLs like app://{d0419af1-8b42-41c5-96f4-ef4179e52315}/index.html for packaged Apps. Closes angular#2112
1 parent 603fe0d commit 9945d50

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

src/ng/location.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
'use strict';
22

3-
var URL_MATCH = /^([^:]+):\/\/(\w+:{0,1}\w*@)?([\w\.-]*)(:([0-9]+))?(\/[^\?#]*)?(\?([^#]*))?(#(.*))?$/,
3+
var URL_MATCH = /^([^:]+):\/\/(\w+:{0,1}\w*@)?([\{\}\w\.-]*)(:([0-9]+))?(\/[^\?#]*)?(\?([^#]*))?(#(.*))?$/,
44
PATH_MATCH = /^([^\?#]*)?(\?([^#]*))?(#(.*))?$/,
55
HASH_MATCH = PATH_MATCH,
66
DEFAULT_PORTS = {'http': 80, 'https': 443, 'ftp': 21};

test/ng/locationSpec.js

+10
Original file line numberDiff line numberDiff line change
@@ -666,6 +666,16 @@ describe('$location', function() {
666666
expect(match[8]).toBe('foo');
667667
expect(match[10]).toBe('bar');
668668
});
669+
670+
it('should parse FFOS app:// urls', function() {
671+
var match = URL_MATCH.exec('app://{d0419af1-8b42-41c5-96f4-ef4179e52315}/path');
672+
673+
expect(match[1]).toBe('app');
674+
expect(match[3]).toBe('{d0419af1-8b42-41c5-96f4-ef4179e52315}');
675+
expect(match[5]).toBeFalsy();
676+
expect(match[6]).toBe('/path');
677+
expect(match[8]).toBeFalsy();
678+
});
669679
});
670680

671681

0 commit comments

Comments
 (0)