ensure MXC URLs properly parsed when media IDs contain hypens, fixes #494

This commit is contained in:
Aine 2025-04-15 11:17:12 +03:00
parent 61013e1875
commit 54b67b3b48
No known key found for this signature in database
GPG Key ID: 34969C908CCA2804

View File

@ -1,5 +1,5 @@
export const getServerAndMediaIdFromMxcUrl = (mxcUrl: string): { serverName: string; mediaId: string } => {
const re = /^mxc:\/\/([^/]+)\/(\w+)/;
const re = /^mxc:\/\/([^/]+)\/([\w-]+)$/;
const ret = re.exec(mxcUrl);
if (ret == null) {
throw new Error("Invalid mxcUrl");