aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexey Rusakov <Kitsune-Ral@users.sf.net>2021-10-03 19:43:03 +0200
committerAlexey Rusakov <Kitsune-Ral@users.sf.net>2021-10-03 19:43:03 +0200
commitec85b9352febb982dd02469635d0553901acce4d (patch)
treeb40aaac428682df98bfe88408acf538f4c4bda54
parentde11927581864a140e3a60e1ff4e8100e4235a6c (diff)
downloadlibquotient-ec85b9352febb982dd02469635d0553901acce4d.tar.gz
libquotient-ec85b9352febb982dd02469635d0553901acce4d.zip
prettyPrint(): tighten up Matrix identifier regex
It was too permissive on characters before the identifier and also allowed the domain name to start on dash, which should not occur. Closes #512.
-rw-r--r--lib/util.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/util.cpp b/lib/util.cpp
index 875d7522..5de8638e 100644
--- a/lib/util.cpp
+++ b/lib/util.cpp
@@ -58,7 +58,7 @@ void Quotient::linkifyUrls(QString& htmlEscapedText)
// https://matrix.org/docs/spec/appendices.html#identifier-grammar
static const QRegularExpression MxIdRegExp(
QStringLiteral(
- R"((^|[^<>/])([!#@][-a-z0-9_=#/.]{1,252}:(?:\w|\.|-)+\.\w+(?::\d{1,5})?))"),
+ R"((^|[][[:space:](){}`'";])([!#@][-a-z0-9_=#/.]{1,252}:\w(?:\w|\.|-)*\.\w+(?::\d{1,5})?))"),
RegExpOptions);
Q_ASSERT(FullUrlRegExp.isValid() && EmailAddressRegExp.isValid()
&& MxIdRegExp.isValid());