Validate "encoding" attribute of "image/png" file nodes.

This commit is contained in:
Jim Evins
2018-02-10 16:06:01 -05:00
parent 0cc3be205f
commit 931294a0f9
+7
View File
@@ -747,6 +747,8 @@ namespace glabels
QString encoding = XmlUtil::getStringAttr( node, "encoding", "base64" );
if ( mimetype == "image/png" )
{
if ( encoding == "base64" )
{
QByteArray ba64 = node.text().toUtf8();
QByteArray ba = QByteArray::fromBase64( ba64 );
@@ -755,6 +757,11 @@ namespace glabels
data.addImage( name, image );
}
else
{
qWarning() << "Unexpected encoding:" << encoding << "node:" << node.tagName();
}
}
else if ( mimetype == "image/svg+xml" )
{
data.addSvg( name, node.text().toUtf8() );