Don't decompress the reply data for Qt 6.3

This commit is contained in:
brvphoenix 2022-05-30 13:10:29 +08:00 committed by Chocobo1
parent 6c546df70b
commit af07a98784

View file

@ -34,10 +34,13 @@
#include "base/3rdparty/expected.hpp" #include "base/3rdparty/expected.hpp"
#include "base/utils/fs.h" #include "base/utils/fs.h"
#include "base/utils/gzip.h"
#include "base/utils/io.h" #include "base/utils/io.h"
#include "base/utils/misc.h" #include "base/utils/misc.h"
#if (QT_VERSION < QT_VERSION_CHECK(6, 3, 0))
#include "base/utils/gzip.h"
#endif
const int MAX_REDIRECTIONS = 20; // the common value for web browsers const int MAX_REDIRECTIONS = 20; // the common value for web browsers
namespace namespace
@ -121,9 +124,13 @@ void DownloadHandlerImpl::processFinishedDownload()
} }
// Success // Success
#if (QT_VERSION >= QT_VERSION_CHECK(6, 3, 0))
m_result.data = m_reply->readAll();
#else
m_result.data = (m_reply->rawHeader("Content-Encoding") == "gzip") m_result.data = (m_reply->rawHeader("Content-Encoding") == "gzip")
? Utils::Gzip::decompress(m_reply->readAll()) ? Utils::Gzip::decompress(m_reply->readAll())
: m_reply->readAll(); : m_reply->readAll();
#endif
if (m_downloadRequest.saveToFile()) if (m_downloadRequest.saveToFile())
{ {