Wiki: Fix work with headwords containing the '+' sign

This commit is contained in:
Abs62 2018-01-31 18:38:16 +03:00
parent 8ba93a6c5a
commit 109bd56f39

View file

@ -125,7 +125,11 @@ MediaWikiWordSearchRequest::MediaWikiWordSearchRequest( wstring const & str,
GD_DPRINTF( "request begin\n" );
QUrl reqUrl( url + "/api.php?action=query&list=allpages&aplimit=40&format=xml" );
Qt4x5::Url::addQueryItem( reqUrl, "apfrom", gd::toQString( str ) );
#if IS_QT_5
Qt4x5::Url::addQueryItem( reqUrl, "apfrom", gd::toQString( str ).replace( '+', "%2B" ) );
#else
reqUrl.addEncodedQueryItem( "apfrom", QUrl::toPercentEncoding( gd::toQString( str ) ) );
#endif
netReply = mgr.get( QNetworkRequest( reqUrl ) );
@ -266,7 +270,11 @@ void MediaWikiArticleRequest::addQuery( QNetworkAccessManager & mgr,
QUrl reqUrl( url + "/api.php?action=parse&prop=text|revid&format=xml&redirects" );
Qt4x5::Url::addQueryItem( reqUrl, "page", gd::toQString( str ) );
#if IS_QT_5
Qt4x5::Url::addQueryItem( reqUrl, "page", gd::toQString( str ).replace( '+', "%2B" ) );
#else
reqUrl.addEncodedQueryItem( "page", QUrl::toPercentEncoding( gd::toQString( str ) ) );
#endif
QNetworkReply * netReply = mgr.get( QNetworkRequest( reqUrl ) );