mirror of
https://gitee.com/vnotex/vnote.git
synced 2025-07-05 13:59:52 +08:00
export: escape ' by %27 in data URI
This commit is contained in:
parent
b88694bf3a
commit
7305706294
@ -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 <title>...</title>.
|
||||
QRegExp reg("<title>.*</title>", Qt::CaseInsensitive);
|
||||
|
@ -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:
|
||||
|
Loading…
x
Reference in New Issue
Block a user