Commit a6eacf6e authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Fix search external reference

Bug found by Filipe Azevedo
parent d5e666ea
...@@ -46,6 +46,7 @@ ...@@ -46,6 +46,7 @@
#include <KEmailAddress> #include <KEmailAddress>
#include <KIconLoader> #include <KIconLoader>
#include <KLocalizedString> #include <KLocalizedString>
#include <QRegularExpression>
#include <QUrl> #include <QUrl>
...@@ -256,7 +257,6 @@ bool containsExternalReferences(const QString &str, const QString &extraHead) ...@@ -256,7 +257,6 @@ bool containsExternalReferences(const QString &str, const QString &extraHead)
} }
int httpPos = str.indexOf(QLatin1String("\"http:"), Qt::CaseInsensitive); int httpPos = str.indexOf(QLatin1String("\"http:"), Qt::CaseInsensitive);
int httpsPos = str.indexOf(QLatin1String("\"https:"), Qt::CaseInsensitive); int httpsPos = str.indexOf(QLatin1String("\"https:"), Qt::CaseInsensitive);
while (httpPos >= 0 || httpsPos >= 0) { while (httpPos >= 0 || httpsPos >= 0) {
// pos = index of next occurrence of "http: or "https: whichever comes first // pos = index of next occurrence of "http: or "https: whichever comes first
int pos = (httpPos < httpsPos) int pos = (httpPos < httpsPos)
...@@ -286,6 +286,10 @@ bool containsExternalReferences(const QString &str, const QString &extraHead) ...@@ -286,6 +286,10 @@ bool containsExternalReferences(const QString &str, const QString &extraHead)
httpsPos = str.indexOf(QLatin1String("\"https:"), httpsPos + 7, Qt::CaseInsensitive); httpsPos = str.indexOf(QLatin1String("\"https:"), httpsPos + 7, Qt::CaseInsensitive);
} }
} }
if (str.indexOf(QRegularExpression(QLatin1String("<img.*src=http:/"), QRegularExpression::CaseInsensitiveOption))
|| str.indexOf(QRegularExpression(QLatin1String("<img.*src=https:/"), QRegularExpression::CaseInsensitiveOption))) {
return true;
}
return false; return false;
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment