Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Collapse double slashes in URLs regardless of Qt version
  • Loading branch information
elpaso committed Dec 9, 2019
1 parent ac958de commit 473a807
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions src/server/qgsserverogcapi.cpp
Expand Up @@ -69,17 +69,13 @@ void QgsServerOgcApi::registerHandler( QgsServerOgcApiHandler *handler )

QUrl QgsServerOgcApi::sanitizeUrl( const QUrl &url )
{
#if QT_VERSION >= QT_VERSION_CHECK(5, 13, 0)
// Since QT 13 NormalizePathSegments does not collapse double slashes
// Since QT 5.12 NormalizePathSegments does not collapse double slashes
QUrl u { url.adjusted( QUrl::StripTrailingSlash | QUrl::NormalizePathSegments ) };
while ( u.path().contains( QLatin1String( "//" ) ) )
if ( u.path().contains( QLatin1String( "//" ) ) )
{
u.setPath( u.path().replace( QLatin1String( "//" ), QChar( '/' ) ) );
}
return u;
#else
return url.adjusted( QUrl::StripTrailingSlash | QUrl::NormalizePathSegments );
#endif
}

void QgsServerOgcApi::executeRequest( const QgsServerApiContext &context ) const
Expand Down

0 comments on commit 473a807

Please sign in to comment.