matrix: URIs #112
1 changed files with 1 additions and 3 deletions
make the matrix: uri regex stricter
some of the "new" tests found an edge case in the previous, lenient regex pattern making it stricter fixes the failures
commit
6326473296
|
|
@ -564,9 +564,7 @@ function serialiseReplyContent(doc) {
|
||||||
* @returns {string}
|
* @returns {string}
|
||||||
*/
|
*/
|
||||||
function convertMatrixUris(input) {
|
function convertMatrixUris(input) {
|
||||||
// this regex is kinda broad, but i'm not really sure how to reasonably make it stricter
|
return input.replace(/(?<![\/:@?#])\b(matrix:[\w\/=?:\.-]+)/gi, (match, uri) => {
|
||||||
// we run the match through the url parser anyway, so if we get a bad match, it should just fail? hopefully?
|
|
||||||
return input.replace(/(?<![\/:@?#])\b(matrix:[^\s"]+)/gi, (match, 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)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue