process %2С as comma in collab links

This commit is contained in:
Konstantin 2024-02-06 13:04:58 +03:00 committed by GitHub
parent 0513b647ec
commit 1202e76eb8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -122,7 +122,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;
@ -132,11 +132,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 () => {