Skip to content

Commit

Permalink
URL Encode plus sign
Browse files Browse the repository at this point in the history
  • Loading branch information
elpaso authored and nyalldawson committed Dec 7, 2021
1 parent 927471e commit 92fae7c
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions src/core/qgsaction.cpp
Expand Up @@ -90,21 +90,22 @@ void QgsAction::run( const QgsExpressionContext &expressionContext ) const
else if ( mType == QgsAction::SubmitUrlEncoded || mType == QgsAction::SubmitUrlMultipart )
{

QUrl url{ command() };
const QUrlQuery queryString { url.query( QUrl::ComponentFormattingOption::FullyDecoded ) };
// Remove query
QString payload { url.query() };
QUrl url{ expandedAction };

// Encode '+' (fully encoded doesn't encode it)
const QString payload { url.query( QUrl::ComponentFormattingOption::FullyEncoded ).replace( QChar( '+' ), QStringLiteral( "%2B" ) ) };

// Remove query string from URL
const QUrlQuery queryString { url.query( ) };
url.setQuery( QString( ) );

QNetworkRequest req { url };
QNetworkReply *reply = nullptr;

// guess content type

// check for json
if ( mType != QgsAction::SubmitUrlMultipart )
{
QString contentType { QStringLiteral( "application/x-www-form-urlencoded" ) };
// check for json
QJsonParseError jsonError;
QJsonDocument::fromJson( payload.toUtf8(), &jsonError );
if ( jsonError.error == QJsonParseError::ParseError::NoError )
Expand Down

0 comments on commit 92fae7c

Please sign in to comment.