Commit 52e38666 authored by Rafał Malinowski's avatar Rafał Malinowski

url: #3154 fixed: invalid '-' characters at end of some urls removed

Signed-off-by: Rafał Malinowski's avatarRafał Malinowski <rafal.przemyslaw.malinowski@gmail.com>
parent 7dfda552
......@@ -4,6 +4,7 @@
* facebook_protocol: support avatars (Vogel)
* jabber_protocol: #3163 fixed: be nicer for SSL certificated for Hangouts on different domains (Vogel)
* icons: #3144 fixed: storing and restoring icons choise works again (Vogel)
* url: #3154 fixed: invalid '-' characters at end of some urls removed (Vogel)
+++ version 5.0-alpha1:
* plugins: #2796 fixed: do not bother user with idle plugin (Vogel)
......
......@@ -68,7 +68,7 @@ void DomProcessor::accept(const DomVisitor *visitor)
QDomDocument toDomDocument(const QString &xml)
{
auto domDocument = QDomDocument{};
auto preparedXml = QString{xml}.replace("<", "-<").replace(">", ">-");
auto preparedXml = QString{xml}.replace("<", "\\<").replace(">", ">\\");
// force content to be valid HTML with only one root
if (domDocument.setContent(QString(R"(<div>%1</div>)").arg(preparedXml)))
return domDocument;
......@@ -87,7 +87,7 @@ QString toString(const QDomDocument &domDocument)
Q_ASSERT(result.endsWith(QStringLiteral("</div>")));
result = result.mid(
static_cast<int>(qstrlen(R"(<div>)")), result.length() - static_cast<int>(qstrlen(R"(<div></div>)")));
return result.replace("-<", "<").replace(">-", ">");
return result.replace("\\<", "<").replace(">\\", ">");
}
QString processDom(const QString &xml, const DomVisitor &domVisitor)
......
......@@ -25,7 +25,7 @@
#include "url-handlers/standard-url-expander.h"
StandardUrlDomVisitorProvider::StandardUrlDomVisitorProvider(Configuration *configuration)
: m_ignoreLinks{std::make_unique<StandardUrlExpander>(QRegExp{"\\b(http://|https://|www\\.|ftp://)([^\\s]*)"})},
: m_ignoreLinks{std::make_unique<StandardUrlExpander>(QRegExp{"\\b(http://|https://|www\\.|ftp://)([^\\s\\\\]*)"})},
m_configurator{configuration}
{
m_configurator.setStandardUrlExpander(static_cast<StandardUrlExpander *>(m_ignoreLinks.visitor()));
......
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