|
|
@@ -25,10 +25,14 @@ const _URI_PATH_PATTERN = '([^?#]*)';
|
|
25
|
25
|
/**
|
|
26
|
26
|
* The {@link RegExp} pattern of the protocol of a URI.
|
|
27
|
27
|
*
|
|
28
|
|
- * @private
|
|
|
28
|
+ * FIXME: The URL class exposed by JavaScript will not include the colon in
|
|
|
29
|
+ * the protocol field. Also in other places (at the time of this writing:
|
|
|
30
|
+ * the UnsupportedMobileBrowser.js) the APP_LINK_SCHEME does not include
|
|
|
31
|
+ * the double dots, so things are inconsistent.
|
|
|
32
|
+ *
|
|
29
|
33
|
* @type {string}
|
|
30
|
34
|
*/
|
|
31
|
|
-const _URI_PROTOCOL_PATTERN = '([a-z][a-z0-9\\.\\+-]*:)';
|
|
|
35
|
+export const URI_PROTOCOL_PATTERN = '([a-z][a-z0-9\\.\\+-]*:)';
|
|
32
|
36
|
|
|
33
|
37
|
/**
|
|
34
|
38
|
* Fixes the hier-part of a specific URI (string) so that the URI is well-known.
|
|
|
@@ -47,7 +51,7 @@ function _fixURIStringHierPart(uri) {
|
|
47
|
51
|
// hipchat.com
|
|
48
|
52
|
let regex
|
|
49
|
53
|
= new RegExp(
|
|
50
|
|
- `^${_URI_PROTOCOL_PATTERN}//hipchat\\.com/video/call/`,
|
|
|
54
|
+ `^${URI_PROTOCOL_PATTERN}//hipchat\\.com/video/call/`,
|
|
51
|
55
|
'gi');
|
|
52
|
56
|
let match: Array<string> | null = regex.exec(uri);
|
|
53
|
57
|
|
|
|
@@ -55,7 +59,7 @@ function _fixURIStringHierPart(uri) {
|
|
55
|
59
|
// enso.me
|
|
56
|
60
|
regex
|
|
57
|
61
|
= new RegExp(
|
|
58
|
|
- `^${_URI_PROTOCOL_PATTERN}//enso\\.me/(?:call|meeting)/`,
|
|
|
62
|
+ `^${URI_PROTOCOL_PATTERN}//enso\\.me/(?:call|meeting)/`,
|
|
59
|
63
|
'gi');
|
|
60
|
64
|
match = regex.exec(uri);
|
|
61
|
65
|
}
|
|
|
@@ -87,7 +91,7 @@ function _fixURIStringHierPart(uri) {
|
|
87
|
91
|
* @returns {string}
|
|
88
|
92
|
*/
|
|
89
|
93
|
function _fixURIStringScheme(uri: string) {
|
|
90
|
|
- const regex = new RegExp(`^${_URI_PROTOCOL_PATTERN}+`, 'gi');
|
|
|
94
|
+ const regex = new RegExp(`^${URI_PROTOCOL_PATTERN}+`, 'gi');
|
|
91
|
95
|
const match: Array<string> | null = regex.exec(uri);
|
|
92
|
96
|
|
|
93
|
97
|
if (match) {
|
|
|
@@ -191,7 +195,7 @@ export function parseStandardURIString(str: string) {
|
|
191
|
195
|
str = str.replace(/\s/g, '');
|
|
192
|
196
|
|
|
193
|
197
|
// protocol
|
|
194
|
|
- regex = new RegExp(`^${_URI_PROTOCOL_PATTERN}`, 'gi');
|
|
|
198
|
+ regex = new RegExp(`^${URI_PROTOCOL_PATTERN}`, 'gi');
|
|
195
|
199
|
match = regex.exec(str);
|
|
196
|
200
|
if (match) {
|
|
197
|
201
|
obj.protocol = match[1].toLowerCase();
|