Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit 3a81dd8

Browse files
Schibummhevery
authored andcommitted
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
1 parent df9bff1 commit 3a81dd8

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-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

+13
Original file line numberDiff line numberDiff line change
@@ -676,6 +676,19 @@ describe('$location', function() {
676676
expect(match[8]).toBe('foo');
677677
expect(match[10]).toBe('bar');
678678
});
679+
680+
it('should parse FFOS app:// urls', function() {
681+
var match = URL_MATCH.exec('app://{d0419af1-8b42-41c5-96f4-ef4179e52315}/path');
682+
683+
expect(match[1]).toBe('app');
684+
expect(match[3]).toBe('{d0419af1-8b42-41c5-96f4-ef4179e52315}');
685+
expect(match[5]).toBeFalsy();
686+
expect(match[6]).toBe('/path');
687+
expect(match[8]).toBeFalsy();
688+
689+
match = URL_MATCH.exec('app://}foo{')
690+
expect(match).toBe(null);
691+
});
679692
});
680693

681694

0 commit comments

Comments
 (0)