summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>2024-04-22 09:14:19 +0200
committerEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>2024-04-25 16:42:11 +0300
commit3117386a4008f5d575d7910f130fba66c740d202 (patch)
tree1b185965513b918a48273f3320b6e64d4e0b6e9c
parentb5a9711109774baed6ea14079ff87802d191d2a9 (diff)
Support loading image file whose name begin with "data"HEADdev
We would assume all filenames beginning with "data" indicated embedded base64, and even if this failed, we would not try loading the file as normal. This made e.g. loading a file called "data.png" impossible. The easy fix is just to check if we successfully loaded the file as data and load it as a file instead if not. Change-Id: I19e532ae7a8fd456ba9717c36820a188a2cec470 Reviewed-by: Hatem ElKharashy <hatem.elkharashy@qt.io>
-rw-r--r--src/svg/qsvghandler.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/svg/qsvghandler.cpp b/src/svg/qsvghandler.cpp
index bf906e8..e6cc9d0 100644
--- a/src/svg/qsvghandler.cpp
+++ b/src/svg/qsvghandler.cpp
@@ -2876,10 +2876,10 @@ static QSvgNode *createImageNode(QSvgNode *parent,
const QString dataStr = filename.mid(idx);
QByteArray data = QByteArray::fromBase64(dataStr.toLatin1());
image = QImage::fromData(data);
- } else {
- qCDebug(lcSvgHandler) << "QSvgHandler::createImageNode: Unrecognized inline image format!";
}
- } else {
+ }
+
+ if (image.isNull()) {
const auto *file = qobject_cast<QFile *>(handler->device());
if (file) {
QUrl url(filename);