diff --git a/src/utils/vwebutils.cpp b/src/utils/vwebutils.cpp index e0235b0f..49a0cc92 100644 --- a/src/utils/vwebutils.cpp +++ b/src/utils/vwebutils.cpp @@ -926,6 +926,7 @@ QString VWebUtils::copyResource(const QUrl &p_url, const QString &p_folder) cons return succ ? targetFile : QString(); } +// Please use single quote to quote the URI. QString VWebUtils::dataURI(const QUrl &p_url, bool p_keepTitle) const { QString uri; @@ -961,6 +962,9 @@ QString VWebUtils::dataURI(const QUrl &p_url, bool p_keepTitle) const // will be removed in M68, around July 2018. Please use '%23' instead. uri.replace("#", "%23"); + // Escape "'" to avoid conflict with src='...' attribute. + uri.replace("'", "%27"); + if (!p_keepTitle) { // Remove .... QRegExp reg(".*", Qt::CaseInsensitive); diff --git a/src/utils/vwebutils.h b/src/utils/vwebutils.h index 4d446951..4ee9465a 100644 --- a/src/utils/vwebutils.h +++ b/src/utils/vwebutils.h @@ -26,6 +26,7 @@ public: QString copyResource(const QUrl &p_url, const QString &p_folder) const; // Return a dataURI of @p_url if it is an image. + // Please use single quote to quote the URI. QString dataURI(const QUrl &p_url, bool p_keepTitle = true) const; private: