Skip to content
Permalink
Browse files
Amend sprite retrieval (#43925)
Update url path with resolution and extension rather than appending to string
  • Loading branch information
wrass authored and github-actions committed Jun 28, 2021
1 parent ea0c6e5 commit a8b17bd107ba8cd1afa1e24c91d9269402584767
Showing with 8 additions and 4 deletions.
  1. +8 −4 src/core/vectortile/qgsvectortilelayer.cpp
@@ -424,7 +424,10 @@ bool QgsVectorTileLayer::loadDefaultStyle( QString &error, QStringList &warnings

for ( int resolution = 2; resolution > 0; resolution-- )
{
QNetworkRequest request = QNetworkRequest( QUrl( spriteUriBase + QStringLiteral( "%1.json" ).arg( resolution > 1 ? QStringLiteral( "@%1x" ).arg( resolution ) : QString() ) ) );
QUrl spriteUrl = QUrl( spriteUriBase );
spriteUrl.setPath( spriteUrl.path() + QStringLiteral( "%1.json" ).arg( resolution > 1 ? QStringLiteral( "@%1x" ).arg( resolution ) : QString() ) );
QNetworkRequest request = QNetworkRequest( spriteUrl );

QgsSetRequestInitiatorClass( request, QStringLiteral( "QgsVectorTileLayer" ) )
QgsBlockingNetworkRequest networkRequest;
switch ( networkRequest.get( request ) )
@@ -435,10 +438,11 @@ bool QgsVectorTileLayer::loadDefaultStyle( QString &error, QStringList &warnings
const QVariantMap spriteDefinition = QgsJsonUtils::parseJson( content.content() ).toMap();

// retrieve sprite images
QNetworkRequest request = QNetworkRequest( QUrl( spriteUriBase + QStringLiteral( "%1.png" ).arg( resolution > 1 ? QStringLiteral( "@%1x" ).arg( resolution ) : QString() ) ) );

QUrl spriteUrl = QUrl( spriteUriBase );
spriteUrl.setPath( spriteUrl.path() + QStringLiteral( "%1.png" ).arg( resolution > 1 ? QStringLiteral( "@%1x" ).arg( resolution ) : QString() ) );
QNetworkRequest request = QNetworkRequest( spriteUrl );

QgsSetRequestInitiatorClass( request, QStringLiteral( "QgsVectorTileLayer" ) )

QgsBlockingNetworkRequest networkRequest;
switch ( networkRequest.get( request ) )
{

0 comments on commit a8b17bd

Please sign in to comment.