diff --git a/excalidraw-app/data/index.ts b/excalidraw-app/data/index.ts index 7bb0f9d8d..1db8b59fc 100644 --- a/excalidraw-app/data/index.ts +++ b/excalidraw-app/data/index.ts @@ -129,7 +129,7 @@ export type SocketUpdateData = _brand: "socketUpdateData"; }; -const RE_COLLAB_LINK = /^#room=([a-zA-Z0-9_-]+),([a-zA-Z0-9_-]+)$/; +const RE_COLLAB_LINK = /^#room=([a-zA-Z0-9_-]+)(,|%2C)([a-zA-Z0-9_-]+)$/; export const isCollaborationLink = (link: string) => { const hash = new URL(link).hash; @@ -139,11 +139,11 @@ export const isCollaborationLink = (link: string) => { export const getCollaborationLinkData = (link: string) => { const hash = new URL(link).hash; const match = hash.match(RE_COLLAB_LINK); - if (match && match[2].length !== 22) { + if (match && match[3].length !== 22) { window.alert(t("alerts.invalidEncryptionKey")); return null; } - return match ? { roomId: match[1], roomKey: match[2] } : null; + return match ? { roomId: match[1], roomKey: match[3] } : null; }; export const generateCollaborationLinkData = async () => {