21 lines
842 B
Diff
21 lines
842 B
Diff
diff --git a/src/corelib/io/qdataurl.cpp b/src/corelib/io/qdataurl.cpp
|
|
index f14d399301f..83e59e3ac00 100644
|
|
--- a/src/corelib/io/qdataurl.cpp
|
|
+++ b/src/corelib/io/qdataurl.cpp
|
|
@@ -76,10 +76,11 @@ Q_CORE_EXPORT bool qDecodeDataUrl(const QUrl &uri, QString &mimeType, QByteArray
|
|
}
|
|
|
|
if (data.toLower().startsWith("charset")) {
|
|
- int i = 7; // strlen("charset")
|
|
- while (data.at(i) == ' ')
|
|
- ++i;
|
|
- if (data.at(i) == '=')
|
|
+ int prefixSize = 7; // strlen("charset")
|
|
+ QLatin1String copy(data.constData() + prefixSize, data.size() - prefixSize);
|
|
+ while (copy.startsWith(QLatin1String(" ")))
|
|
+ copy = copy.mid(1);
|
|
+ if (copy.startsWith(QLatin1String("=")))
|
|
data.prepend("text/plain;");
|
|
}
|
|
|