From deb7afa8571c4dfea1acc216088ef7bd496a0d94 Mon Sep 17 00:00:00 2001 From: Vitaly Slobodin Date: Sun, 2 Aug 2015 13:56:42 +0300 Subject: [PATCH] Cast response body to string in binary mode. QVariantHelper expects body to be the same type as before conversion. If target type doesn't match the source type, QVariantHelper will return 0. We can't convert in this way: QString > QVariant -> QByteArray Instead we must use the following way: QString > QVariant -> QString Fixes: #13026 --- src/webserver.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/webserver.cpp b/src/webserver.cpp index 656bee8901..a93c86160a 100644 --- a/src/webserver.cpp +++ b/src/webserver.cpp @@ -409,7 +409,7 @@ void WebServerResponse::write(const QVariant& body) if (m_encoding.isEmpty()) { data = body.toString().toUtf8(); } else if (m_encoding.toLower() == "binary") { - data = body.toByteArray(); + data = body.toString().toLatin1(); } else { Encoding encoding; encoding.setEncoding(m_encoding);