mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-27 00:33:48 -05:00
Allow remote SVG files with text/plain MIME type, instead of only
valid image/svg+xml mime types This allows users to link to SVG files hosted on github, where the raw content is served up as plain text.
This commit is contained in:
parent
50241dcba4
commit
d3aae3f5b6
@ -461,10 +461,13 @@ QByteArray QgsSvgCache::getImageData( const QString &path ) const
|
||||
return mMissingSvg;
|
||||
}
|
||||
|
||||
// we accept both real SVG mime types AND plain text types - because some sites
|
||||
// (notably github) serve up svgs as raw text
|
||||
QString contentType = reply->header( QNetworkRequest::ContentTypeHeader ).toString();
|
||||
QgsDebugMsg( "contentType: " + contentType );
|
||||
if ( !contentType.startsWith( QLatin1String( "image/svg+xml" ), Qt::CaseInsensitive ) )
|
||||
if ( !contentType.startsWith( QLatin1String( "image/svg+xml" ), Qt::CaseInsensitive )
|
||||
&& !contentType.startsWith( QLatin1String( "text/plain" ), Qt::CaseInsensitive ) )
|
||||
{
|
||||
QgsMessageLog::logMessage( tr( "Unexpected MIME type %1 received for %2" ).arg( contentType, path ), tr( "SVG" ) );
|
||||
reply->deleteLater();
|
||||
return mMissingSvg;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user