fixed case sensitivity in link matching

This commit is contained in:
fourtf 2019-12-29 15:45:19 +01:00
parent e12f76387a
commit 17ff0b9d83

View file

@ -52,7 +52,7 @@ namespace {
#ifdef C_MATCH_IPV6_LINK #ifdef C_MATCH_IPV6_LINK
bool isValidIpv6(QStringRef &host) bool isValidIpv6(QStringRef &host)
{ {
static auto exp = QRegularExpression("^\\[[a-f0-9:%]+\\]$"); static auto exp = QRegularExpression("^\\[[a-fA-F0-9:%]+\\]$");
return exp.match(host).hasMatch(); return exp.match(host).hasMatch();
} }
@ -70,12 +70,12 @@ LinkParser::LinkParser(const QString &unparsedString)
bool hasHttp = false; bool hasHttp = false;
// Protocol `https?://` // Protocol `https?://`
if (l.startsWith("https://")) if (l.startsWith("https://", Qt::CaseInsensitive))
{ {
hasHttp = true; hasHttp = true;
l = l.mid(8); l = l.mid(8);
} }
else if (l.startsWith("http://")) else if (l.startsWith("http://", Qt::CaseInsensitive))
{ {
hasHttp = true; hasHttp = true;
l = l.mid(7); l = l.mid(7);