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()
const QByteArray nameComponent = midView(param, 0, sepPos); const QByteArray nameComponent = midView(param, 0, sepPos);
const QByteArray valueComponent = midView(param, (sepPos + 1)); const QByteArray valueComponent = midView(param, (sepPos + 1));
const QString paramName = QString::fromUtf8(QByteArray::fromPercentEncoding(nameComponent)); const QString paramName = QString::fromUtf8(QByteArray::fromPercentEncoding(nameComponent).replace('+', ' '));
const QByteArray paramValue = QByteArray::fromPercentEncoding(valueComponent); const QByteArray paramValue = QByteArray::fromPercentEncoding(valueComponent).replace('+', ' ');
queryParams[paramName] = paramValue; queryParams[paramName] = paramValue;
} }

5
src/webui/webapplication.cpp

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

Loading…
Cancel
Save