ensure MXC URLs properly parsed when media IDs contain hypens, fixes #494
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
export const getServerAndMediaIdFromMxcUrl = (mxcUrl: string): { serverName: string; mediaId: string } => {
|
export const getServerAndMediaIdFromMxcUrl = (mxcUrl: string): { serverName: string; mediaId: string } => {
|
||||||
const re = /^mxc:\/\/([^/]+)\/(\w+)/;
|
const re = /^mxc:\/\/([^/]+)\/([\w-]+)$/;
|
||||||
const ret = re.exec(mxcUrl);
|
const ret = re.exec(mxcUrl);
|
||||||
if (ret == null) {
|
if (ret == null) {
|
||||||
throw new Error("Invalid mxcUrl");
|
throw new Error("Invalid mxcUrl");
|
||||||
|
Reference in New Issue
Block a user