diff options
author | Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io> | 2024-04-22 09:14:19 +0200 |
---|---|---|
committer | Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io> | 2024-04-25 16:42:11 +0300 |
commit | 3117386a4008f5d575d7910f130fba66c740d202 (patch) | |
tree | 1b185965513b918a48273f3320b6e64d4e0b6e9c | |
parent | b5a9711109774baed6ea14079ff87802d191d2a9 (diff) |
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.cpp | 6 |
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); |