Skip to content

Commit

Permalink
Fix QT 5.13 issue with url sanitizer
Browse files Browse the repository at this point in the history
  • Loading branch information
elpaso committed Nov 12, 2019
1 parent db83675 commit e818fc6
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/server/qgsserverogcapi.cpp
Expand Up @@ -16,6 +16,7 @@

#include <QDir>
#include <QDebug>
#include <QtGlobal>

#include "qgsserverogcapi.h"
#include "qgsserverogcapihandler.h"
Expand Down Expand Up @@ -68,7 +69,17 @@ 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
QUrl u { url.adjusted( QUrl::StripTrailingSlash | QUrl::NormalizePathSegments ) };
while ( 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 e818fc6

Please sign in to comment.