matrix: URIs #112
1 changed files with 12 additions and 20 deletions
replace switch with if/else, don't encode sigils
commit
919f3e2851
|
|
@ -604,28 +604,20 @@ function convertMatrixUris(input) {
|
||||||
const id = segments.shift()
|
const id = segments.shift()
|
||||||
let sigil
|
let sigil
|
||||||
|
|
||||||
switch(type) {
|
if (type === "r" || type === "room") {
|
||||||
case "r":
|
sigil = "#"
|
||||||
case "room":
|
} else if (type === "roomid") {
|
||||||
sigil = "#"
|
sigil = "!"
|
||||||
break
|
} else if (type === "e" || type === "event") {
|
||||||
case "roomid":
|
sigil = "$"
|
||||||
sigil = "!"
|
} else if (type === "u" || type === "user") {
|
||||||
break
|
sigil = "@"
|
||||||
case "e":
|
} else {
|
||||||
case "event":
|
// unknown type! bail
|
||||||
sigil = "$"
|
return match
|
||||||
break
|
|
||||||
case "u":
|
|
||||||
case "user":
|
|
||||||
sigil = "@"
|
|
||||||
break
|
|
||||||
default:
|
|
||||||
// unknown type! bail
|
|
||||||
return match
|
|
||||||
}
|
}
|
||||||
|
|
||||||
resultSegments.push(`${encodeURIComponent(sigil)}${id}`)
|
resultSegments.push(`${sigil}${id}`)
|
||||||
}
|
}
|
||||||
|
|
||||||
// now splice the path back together, add the query, and we're done!
|
// now splice the path back together, add the query, and we're done!
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue