matrix: URIs #112

Merged
cadence merged 8 commits from mschae/out-of-your-element:matrix-uris into main 2026-11-28 03:44:30 +00:00
Showing only changes of commit 18e2421ac5 - Show all commits

make matrix: uri scheme match case-insensitive

mini-bomba 2026-11-19 00:34:17 +01:00
No known key found for this signature in database
GPG key ID: 30F8B138B4794886

View file

@ -566,7 +566,7 @@ function serialiseReplyContent(doc) {
function convertMatrixUris(input) { function convertMatrixUris(input) {
// this regex is kinda broad, but i'm not really sure how to reasonably make it stricter // this regex is kinda broad, but i'm not really sure how to reasonably make it stricter
// we run the match through the url parser anyway, so if we get a bad match, it should just fail? hopefully? // we run the match through the url parser anyway, so if we get a bad match, it should just fail? hopefully?
return input.replace(/(^|\s|")(matrix:[^\s"]+)/g, (match, before, uri) => { return input.replace(/(^|\s|")(matrix:[^\s"]+)/gi, (match, before, uri) => {
// technically the url might be html-encoded, but since we're gonna splice the url back together, // technically the url might be html-encoded, but since we're gonna splice the url back together,
// and none of the characters that might get html-encoded are actually important to us, it doesn't really matter // and none of the characters that might get html-encoded are actually important to us, it doesn't really matter
// (most of the case it's the query string, and we just copy it over anyway) // (most of the case it's the query string, and we just copy it over anyway)