More strict filter for URL handling in dive notes

Applie a more strict filter to URL handling in dive notes:
The URL needs to have:
- Scheme like "http:" or "mailto:"
- Host name like "www.test.de" or path like "/pathtosomewhere/"

Otherwise strings like "OTU:" or "Runtime:" are treated as URL.

Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
This commit is contained in:
Stefan Fuchs 2017-04-18 23:41:55 +02:00 committed by Dirk Hohndel
parent c257144bab
commit 5e67a932cf

View file

@ -704,7 +704,7 @@ void TextHyperlinkEventFilter::handleUrlTooltip(const QString &urlStr, const QPo
bool TextHyperlinkEventFilter::stringMeetsOurUrlRequirements(const QString &maybeUrlStr)
{
QUrl url(maybeUrlStr, QUrl::StrictMode);
return url.isValid() && (!url.scheme().isEmpty());
return url.isValid() && (!url.scheme().isEmpty()) && ((!url.authority().isEmpty()) || (!url.path().isEmpty()));
}
QString TextHyperlinkEventFilter::tryToFormulateUrl(QTextCursor *cursor)