summaryrefslogtreecommitdiffstats
path: root/src/corelib/io/qdataurl.cpp
diff options
context:
space:
mode:
authorAhmad Samir <a.samirh78@gmail.com>2025-04-22 22:00:58 +0200
committerAhmad Samir <a.samirh78@gmail.com>2025-05-24 01:12:55 +0300
commit71bcd74542e37825cb1837f162b5b2310b6ebcb9 (patch)
treedde93d9d391f63dbc9ebf223e3f2553563104e74 /src/corelib/io/qdataurl.cpp
parent8df6859f089b117d5ce2b4863a8f6f334c6f9082 (diff)
qdataurl: don't set the mime type too early
If there is no actual data to decode, setting the mime type is redundant. Also only set the mime type to the default if none is specified in the URL. Change-Id: I19f7ae98c7f1f4483069f580bea028a84a719656 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/io/qdataurl.cpp')
-rw-r--r--src/corelib/io/qdataurl.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/corelib/io/qdataurl.cpp b/src/corelib/io/qdataurl.cpp
index c5ecca8fb82..2d2426e8ea5 100644
--- a/src/corelib/io/qdataurl.cpp
+++ b/src/corelib/io/qdataurl.cpp
@@ -20,8 +20,6 @@ Q_CORE_EXPORT bool qDecodeDataUrl(const QUrl &uri, QString &mimeType, QByteArray
if (uri.scheme() != "data"_L1 || !uri.host().isEmpty())
return false;
- mimeType = QStringLiteral("text/plain;charset=US-ASCII");
-
// the following would have been the correct thing, but
// reality often differs from the specification. People have
// data: URIs with ? and #
@@ -56,6 +54,8 @@ Q_CORE_EXPORT bool qDecodeDataUrl(const QUrl &uri, QString &mimeType, QByteArray
if (!data.isEmpty())
mimeType = textPlain + QLatin1StringView(data.trimmed());
+ else
+ mimeType = QStringLiteral("text/plain;charset=US-ASCII");
}
return true;