Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Step:15-SP2
libqt5-qtsvg.21342
0019-Allow-loading-SVG-files-with-a-doctype-dec...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0019-Allow-loading-SVG-files-with-a-doctype-declaration.patch of Package libqt5-qtsvg.21342
From 47e94a3ec363eba1189f8f16246df43c76cbd833 Mon Sep 17 00:00:00 2001 From: Nicolas Fella <nicolas.fella@kdab.com> Date: Sat, 19 Sep 2020 16:56:21 +0200 Subject: [PATCH 19/21] Allow loading SVG files with a doctype declaration SVGs may have a DOCTYPE declaration (https://www.w3.org/TR/2003/REC-SVGMobile-20030114/) in their first line. This patch makes sure those SVGs are loaded properly Fixes: QTBUG-87583 Change-Id: Ia3dcb519b6ee2b498dc81ef496764d99ea6c4a9a Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io> Reviewed-by: Robert Loehning <robert.loehning@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> (cherry picked from commit 2f63ddc6afeb3d2c3c7a42add0129547acd61ede) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> (cherry picked from commit fab0ed9a65a451d9a7a3b7ac617a0abc3176049a) --- src/plugins/imageformats/svg/qsvgiohandler.cpp | 8 ++++---- src/svg/qsvgtinydocument.cpp | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/plugins/imageformats/svg/qsvgiohandler.cpp b/src/plugins/imageformats/svg/qsvgiohandler.cpp index a999d47..5e96d27 100644 --- a/src/plugins/imageformats/svg/qsvgiohandler.cpp +++ b/src/plugins/imageformats/svg/qsvgiohandler.cpp @@ -126,14 +126,14 @@ bool QSvgIOHandler::canRead() const if (d->loaded && !d->readDone) return true; // Will happen if we have been asked for the size - QByteArray buf = device()->peek(8); + QByteArray buf = device()->peek(16); #ifndef QT_NO_COMPRESS if (buf.startsWith("\x1f\x8b")) { setFormat("svgz"); return true; } else #endif - if (buf.contains("<?xml") || buf.contains("<svg") || buf.contains("<!--")) { + if (buf.contains("<?xml") || buf.contains("<svg") || buf.contains("<!--") || buf.contains("<!DOCTYPE svg")) { setFormat("svg"); return true; } @@ -267,12 +267,12 @@ bool QSvgIOHandler::supportsOption(ImageOption option) const bool QSvgIOHandler::canRead(QIODevice *device) { - QByteArray buf = device->peek(8); + QByteArray buf = device->peek(16); return #ifndef QT_NO_COMPRESS buf.startsWith("\x1f\x8b") || #endif - buf.contains("<?xml") || buf.contains("<svg") || buf.contains("<!--"); + buf.contains("<?xml") || buf.contains("<svg") || buf.contains("<!--") || buf.contains("<!DOCTYPE svg"); } QT_END_NAMESPACE diff --git a/src/svg/qsvgtinydocument.cpp b/src/svg/qsvgtinydocument.cpp index da3d142..38db330 100644 --- a/src/svg/qsvgtinydocument.cpp +++ b/src/svg/qsvgtinydocument.cpp @@ -157,8 +157,8 @@ static QByteArray qt_inflateSvgzDataFrom(QIODevice *device, bool doCheckContent) if (doCheckContent) { // Quick format check, equivalent to QSvgIOHandler::canRead() - QByteArray buf = destination.left(8); - if (!buf.contains("<?xml") && !buf.contains("<svg") && !buf.contains("<!--")) { + QByteArray buf = destination.left(16); + if (!buf.contains("<?xml") && !buf.contains("<svg") && !buf.contains("<!--") && !buf.contains("<!DOCTYPE svg")) { inflateEnd(&zlibStream); qCWarning(lcSvgHandler, "Error while inflating gzip file: SVG format check failed"); return QByteArray(); -- 2.20.1
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor