Browse Source

Fix '+' char not decoded to space correctly

Closes #10606.
adaptive-webui-19844
Chocobo1 6 years ago
parent
commit
69d29af097
No known key found for this signature in database
GPG Key ID: 210D9C873253A68C
  1. 4
      src/base/bittorrent/tracker.cpp
  2. 5
      src/webui/webapplication.cpp

4
src/base/bittorrent/tracker.cpp

@ -143,8 +143,8 @@ void Tracker::respondToAnnounceRequest() @@ -143,8 +143,8 @@ void Tracker::respondToAnnounceRequest()
const QByteArray nameComponent = midView(param, 0, sepPos);
const QByteArray valueComponent = midView(param, (sepPos + 1));
const QString paramName = QString::fromUtf8(QByteArray::fromPercentEncoding(nameComponent));
const QByteArray paramValue = QByteArray::fromPercentEncoding(valueComponent);
const QString paramName = QString::fromUtf8(QByteArray::fromPercentEncoding(nameComponent).replace('+', ' '));
const QByteArray paramValue = QByteArray::fromPercentEncoding(valueComponent).replace('+', ' ');
queryParams[paramName] = paramValue;
}

5
src/webui/webapplication.cpp

@ -415,6 +415,7 @@ Http::Response WebApplication::processRequest(const Http::Request &request, cons @@ -415,6 +415,7 @@ Http::Response WebApplication::processRequest(const Http::Request &request, cons
m_request = request;
m_env = env;
m_params.clear();
if (m_request.method == Http::METHOD_GET) {
// Parse GET parameters
using namespace Utils::ByteArray;
@ -425,8 +426,8 @@ Http::Response WebApplication::processRequest(const Http::Request &request, cons @@ -425,8 +426,8 @@ Http::Response WebApplication::processRequest(const Http::Request &request, cons
const QByteArray nameComponent = midView(param, 0, sepPos);
const QByteArray valueComponent = midView(param, (sepPos + 1));
const QString paramName = QString::fromUtf8(QByteArray::fromPercentEncoding(nameComponent));
const QString paramValue = QString::fromUtf8(QByteArray::fromPercentEncoding(valueComponent));
const QString paramName = QString::fromUtf8(QByteArray::fromPercentEncoding(nameComponent).replace('+', ' '));
const QString paramValue = QString::fromUtf8(QByteArray::fromPercentEncoding(valueComponent).replace('+', ' '));
m_params[paramName] = paramValue;
}
}

Loading…
Cancel
Save