Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[WFS provider] Encode space as %20 in URL
Relates to #42985
  • Loading branch information
rouault authored and nyalldawson committed May 21, 2021
1 parent d1d3da1 commit c8067ea
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/providers/wfs/qgsbasenetworkrequest.cpp
Expand Up @@ -121,8 +121,16 @@ bool QgsBaseNetworkRequest::sendGET( const QUrl &url, const QString &acceptHeade
QgsDebugMsgLevel( QStringLiteral( "Get %1 (after laundering)" ).arg( modifiedUrlString ), 4 );
modifiedUrl = QUrl::fromLocalFile( modifiedUrlString );
}
else
{
// Some servers don't like spaces not encoded
// e.g the following fails because of the space after fes%3AFilter and before xmlns%31:fes
// but works if replacing it with %20
// http://geocloud.vd.dk/NR/wfs?SERVICE=WFS&REQUEST=GetFeature&VERSION=2.0.0&TYPENAMES=NR:nr_byggelinjer&STARTINDEX=0&COUNT=1&SRSNAME=urn:ogc:def:crs:EPSG::25832&FILTER=%3Cfes%3AFilter xmlns%3Afes%3D%22http%3A%2F%2Fwww.opengis.net%2Ffes%2F2.0%22%20xmlns%3Agml%3D%22http%3A%2F%2Fwww.opengis.net%2Fgml%2F3.2%22%3E%0A%3Cfes%3ADisjoint%3E%0A%3Cfes%3AValueReference%3EGEOMETRY%3C%2Ffes%3AValueReference%3E%0A%3Cgml%3APoint%20srsName%3D%22urn%3Aogc%3Adef%3Acrs%3AEPSG%3A%3A25832%22%20gml%3Aid%3D%22qgis_id_geom_1%22%3E%0A%3Cgml%3Apos%20srsDimension%3D%222%22%3E0%200%3C%2Fgml%3Apos%3E%0A%3C%2Fgml%3APoint%3E%0A%3C%2Ffes%3ADisjoint%3E%0A%3C%2Ffes%3AFilter%3E%0A&SORTBY=BESTEMMELSEN
modifiedUrl = modifiedUrl.adjusted( QUrl::EncodeSpaces );
}

QgsDebugMsgLevel( QStringLiteral( "Calling: %1" ).arg( modifiedUrl.toDisplayString( ) ), 4 );
QgsDebugMsgLevel( QStringLiteral( "Calling: %1" ).arg( modifiedUrl.toDisplayString( QUrl::EncodeSpaces ) ), 4 );

QNetworkRequest request( modifiedUrl );
if ( !acceptHeader.isEmpty() )
Expand Down

0 comments on commit c8067ea

Please sign in to comment.