|
@@ -45,17 +45,18 @@ const _URI_PATH_PATTERN = '([^?#]*)';
|
45
|
45
|
export const URI_PROTOCOL_PATTERN = '^([a-z][a-z0-9\\.\\+-]*:)';
|
46
|
46
|
|
47
|
47
|
/**
|
48
|
|
- * Excludes/removes certain characters from a specific room (name) which are
|
49
|
|
- * incompatible with Jitsi Meet on the client and/or server sides.
|
|
48
|
+ * Excludes/removes certain characters from a specific path part which are
|
|
49
|
+ * incompatible with Jitsi Meet on the client and/or server sides. The main
|
|
50
|
+ * use case for this method is to clean up the room name and the tenant.
|
50
|
51
|
*
|
51
|
|
- * @param {?string} room - The room (name) to fix.
|
|
52
|
+ * @param {?string} pathPart - The path part to fix.
|
52
|
53
|
* @private
|
53
|
54
|
* @returns {?string}
|
54
|
55
|
*/
|
55
|
|
-function _fixRoom(room: ?string) {
|
56
|
|
- return room
|
57
|
|
- ? room.replace(new RegExp(_ROOM_EXCLUDE_PATTERN, 'g'), '')
|
58
|
|
- : room;
|
|
56
|
+function _fixPathPart(pathPart: ?string) {
|
|
57
|
+ return pathPart
|
|
58
|
+ ? pathPart.replace(new RegExp(_ROOM_EXCLUDE_PATTERN, 'g'), '')
|
|
59
|
+ : pathPart;
|
59
|
60
|
}
|
60
|
61
|
|
61
|
62
|
/**
|
|
@@ -335,6 +336,11 @@ export function parseURIString(uri: ?string) {
|
335
|
336
|
|
336
|
337
|
const obj = parseStandardURIString(_fixURIStringScheme(uri));
|
337
|
338
|
|
|
339
|
+ // XXX While the components/segments of pathname are URI encoded, Jitsi Meet
|
|
340
|
+ // on the client and/or server sides still don't support certain characters.
|
|
341
|
+ obj.pathname = obj.pathname.split('/').map(pathPart => _fixPathPart(pathPart))
|
|
342
|
+ .join('/');
|
|
343
|
+
|
338
|
344
|
// Add the properties that are specific to a Jitsi Meet resource (location)
|
339
|
345
|
// such as contextRoot, room:
|
340
|
346
|
|
|
@@ -344,24 +350,9 @@ export function parseURIString(uri: ?string) {
|
344
|
350
|
// The room (name) is the last component/segment of pathname.
|
345
|
351
|
const { pathname } = obj;
|
346
|
352
|
|
347
|
|
- // XXX While the components/segments of pathname are URI encoded, Jitsi Meet
|
348
|
|
- // on the client and/or server sides still don't support certain characters.
|
349
|
353
|
const contextRootEndIndex = pathname.lastIndexOf('/');
|
350
|
|
- let room = pathname.substring(contextRootEndIndex + 1) || undefined;
|
351
|
|
-
|
352
|
|
- if (room) {
|
353
|
|
- const fixedRoom = _fixRoom(room);
|
354
|
|
-
|
355
|
|
- if (fixedRoom !== room) {
|
356
|
|
- room = fixedRoom;
|
357
|
354
|
|
358
|
|
- // XXX Drive fixedRoom into pathname (because room is derived from
|
359
|
|
- // pathname).
|
360
|
|
- obj.pathname
|
361
|
|
- = pathname.substring(0, contextRootEndIndex + 1) + (room || '');
|
362
|
|
- }
|
363
|
|
- }
|
364
|
|
- obj.room = room;
|
|
355
|
+ obj.room = pathname.substring(contextRootEndIndex + 1) || undefined;
|
365
|
356
|
|
366
|
357
|
if (contextRootEndIndex > 1) {
|
367
|
358
|
// The part of the pathname from the beginning to the room name is the tenant.
|