File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed
Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change 66#include " asyncimageresponse.h"
77
88#include < QIcon>
9+ #include < QMimeDatabase>
910#include < QPainter>
1011#include < QSvgRenderer>
1112
@@ -116,11 +117,10 @@ void AsyncImageResponse::processNetworkReply(QNetworkReply *reply)
116117 return ;
117118 }
118119
119- // check whether the reply might be an SVG by looking at the content type and the first 512 bytes of the response for `<svg`.
120120 // Some graphics programs export SVGs that begin with `<?xml version="1.0" [...]` and/or include some comments after that (e.g.
121121 // `<!-- Generator: ...`), so we can't rely on just the response to start with `<svg`.
122- if (const auto contentTypeHeader = reply-> header (QNetworkRequest::ContentTypeHeader );
123- !(contentTypeHeader. toString (). startsWith (" image/svg" _ba) || imageData. first ( qMin (imageData. size (), 512 )). contains ( " <svg " _ba ))) {
122+ if (const auto mimetype = QMimeDatabase (). mimeTypeForData (imageData );
123+ !(mimetype. isValid () && mimetype. inherits (" image/svg+xml " _L1 ))) {
124124 // Not an SVG: let's let QImage deal with the response.
125125 setImageAndEmitFinished (QImage::fromData (imageData).scaled (_requestedImageSize));
126126 return ;
You can’t perform that action at this time.
0 commit comments