Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #9115 from m-kuhn/wmts-getcapabilities-compat
Append ? to WMTS GetCapabilities
  • Loading branch information
m-kuhn committed Feb 6, 2019
2 parents d92f9e7 + 76ac0f1 commit 31ab3bb
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
8 changes: 6 additions & 2 deletions src/server/services/wmts/qgswmtsgetcapabilities.cpp
Expand Up @@ -272,8 +272,12 @@ namespace QgsWmts
QDomElement httpElement = doc.createElement( QStringLiteral( "ows:HTTP" )/*ows:HTTP*/ );
dcpElement.appendChild( httpElement );

//Prepare url
QString hrefString = serviceUrl( request, project );
// Get service URL
const QUrl href = serviceUrl( request, project );

//href needs to be a prefix
QString hrefString = href.toString();
hrefString.append( href.hasQuery() ? '&' : '?' );

//ows:Get
QDomElement getElement = doc.createElement( QStringLiteral( "ows:Get" )/*ows:Get*/ );
Expand Down
6 changes: 3 additions & 3 deletions tests/testdata/qgis_server/wmts_getcapabilities_config.txt
Expand Up @@ -20,21 +20,21 @@ Content-Type: text/xml; charset=utf-8
<ows:Operation name="GetCapabilities">
<ows:DCP>
<ows:HTTP>
<ows:Get xlink:href="https://www.qgis.org/"/>
<ows:Get xlink:href="https://www.qgis.org/?"/>
</ows:HTTP>
</ows:DCP>
</ows:Operation>
<ows:Operation name="GetTile">
<ows:DCP>
<ows:HTTP>
<ows:Get xlink:href="https://www.qgis.org/"/>
<ows:Get xlink:href="https://www.qgis.org/?"/>
</ows:HTTP>
</ows:DCP>
</ows:Operation>
<ows:Operation name="GetFeatureInfo">
<ows:DCP>
<ows:HTTP>
<ows:Get xlink:href="https://www.qgis.org/"/>
<ows:Get xlink:href="https://www.qgis.org/?"/>
</ows:HTTP>
</ows:DCP>
</ows:Operation>
Expand Down
Expand Up @@ -20,21 +20,21 @@ Content-Type: text/xml; charset=utf-8
<ows:Operation name="GetCapabilities">
<ows:DCP>
<ows:HTTP>
<ows:Get xlink:href="https://www.qgis.org/"/>
<ows:Get xlink:href="https://www.qgis.org/?"/>
</ows:HTTP>
</ows:DCP>
</ows:Operation>
<ows:Operation name="GetTile">
<ows:DCP>
<ows:HTTP>
<ows:Get xlink:href="https://www.qgis.org/"/>
<ows:Get xlink:href="https://www.qgis.org/?"/>
</ows:HTTP>
</ows:DCP>
</ows:Operation>
<ows:Operation name="GetFeatureInfo">
<ows:DCP>
<ows:HTTP>
<ows:Get xlink:href="https://www.qgis.org/"/>
<ows:Get xlink:href="https://www.qgis.org/?"/>
</ows:HTTP>
</ows:DCP>
</ows:Operation>
Expand Down

0 comments on commit 31ab3bb

Please sign in to comment.