qdataurl: treat comma as mandatory in the data URL syntax
In the syntax specified in https://www.rfc-editor.org/rfc/rfc2397.html: data:[<mediatype>][;base64],<data> The comma isn't inside square brackets, so not optional. Change the unittests accordingly, "data:text/plain" isn't empty data, it's rather malformed. [ChangeLog][QtCore] Changed parsing 'data:' URLs to report failure if the comma is missing, this makes it more compliant with RFC 2397. [ChangeLog][QtNetwork][QNetworkManager] Changed parsing 'data:' URLs to report failure if the comma is missing, this makes it more compliant RFC 2397. Change-Id: I91c45f42257de7840ab45c0f8eb31b8df3d483bc Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
parent
71bcd74542
commit
cec5066f32
@ -56,9 +56,10 @@ Q_CORE_EXPORT bool qDecodeDataUrl(const QUrl &uri, QString &mimeType, QByteArray
|
||||
mimeType = textPlain + QLatin1StringView(data.trimmed());
|
||||
else
|
||||
mimeType = QStringLiteral("text/plain;charset=US-ASCII");
|
||||
return true;
|
||||
}
|
||||
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
@ -31,7 +31,7 @@ void tst_QDataUrl::decode_data()
|
||||
row("malformed-host", "data://test.com", false);
|
||||
row("malformed-host2", "data://text/plain;charset=ISO-8859-1", false);
|
||||
row("malformed-host3", "data://test.com/,", false);
|
||||
row("emptyData", "data:text/plain", true);
|
||||
row("malformed-no-comma", "data:text/plain", false);
|
||||
row("emptyData-default-mimetype", "data:,", true,
|
||||
"text/plain;charset=US-ASCII"_L1, "");
|
||||
row("emptyData-only-charset", "data:charset=ISO-8859-1,", true,
|
||||
|
Loading…
x
Reference in New Issue
Block a user