Skip to content
This repository has been archived by the owner on Dec 21, 2018. It is now read-only.

Commit

Permalink
Cast response body to string in binary mode.
Browse files Browse the repository at this point in the history
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: ariya#13026
  • Loading branch information
vitallium committed Aug 6, 2015
1 parent 8b79f62 commit deb7afa
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/webserver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit deb7afa

Please sign in to comment.