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()
|
||||
let sigil
|
||||
|
||||
switch(type) {
|
||||
case "r":
|
||||
case "room":
|
||||
if (type === "r" || type === "room") {
|
||||
sigil = "#"
|
||||
break
|
||||
case "roomid":
|
||||
} else if (type === "roomid") {
|
||||
sigil = "!"
|
||||
break
|
||||
case "e":
|
||||
case "event":
|
||||
} else if (type === "e" || type === "event") {
|
||||
sigil = "$"
|
||||
break
|
||||
case "u":
|
||||
case "user":
|
||||
} else if (type === "u" || type === "user") {
|
||||
sigil = "@"
|
||||
break
|
||||
default:
|
||||
} else {
|
||||
// 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!
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue