Relax mxc regexp
The spec doesn't say which characters are permitted in the opaque ID, but in real life we at least need a hyphen. For lack of a better reference, I copied gomuks.
This commit is contained in:
+1
-1
@@ -474,7 +474,7 @@ async function ping() {
|
|||||||
async function getMedia(mxc, init = {}) {
|
async function getMedia(mxc, init = {}) {
|
||||||
init = {...init}
|
init = {...init}
|
||||||
|
|
||||||
const mediaParts = mxc?.match(/^mxc:\/\/([^/]+)\/(\w+)$/)
|
const mediaParts = mxc?.match(/^mxc:\/\/([^/]+)\/([a-zA-Z0-9_-]+)$/)
|
||||||
assert(mediaParts)
|
assert(mediaParts)
|
||||||
|
|
||||||
let route = "download"
|
let route = "download"
|
||||||
|
|||||||
+1
-1
@@ -250,7 +250,7 @@ function getPublicUrlForMxc(mxc) {
|
|||||||
*/
|
*/
|
||||||
function makeMxcPublic(mxc) {
|
function makeMxcPublic(mxc) {
|
||||||
assert(hasher, "xxhash is not ready yet")
|
assert(hasher, "xxhash is not ready yet")
|
||||||
const mediaParts = mxc?.match(/^mxc:\/\/([^/]+)\/(\w+)$/)
|
const mediaParts = mxc?.match(/^mxc:\/\/([^/]+)\/([a-zA-Z0-9_-]+)$/)
|
||||||
if (!mediaParts) return undefined
|
if (!mediaParts) return undefined
|
||||||
|
|
||||||
const serverAndMediaID = `${mediaParts[1]}/${mediaParts[2]}`
|
const serverAndMediaID = `${mediaParts[1]}/${mediaParts[2]}`
|
||||||
|
|||||||
Reference in New Issue
Block a user