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

fix($location): parse FirefoxOS packaged app urls #2114

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
  • Loading branch information
Schibum committed Mar 7, 2013
commit 9945d5027305970a41a22bcd1b8eee7cf68ff8f6
2 changes: 1 addition & 1 deletion src/ng/location.js
Original file line number Diff line number Diff line change
@@ -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};
Expand Down
10 changes: 10 additions & 0 deletions test/ng/locationSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -666,6 +666,16 @@ 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();
});
});


Expand Down