Merge pull request #2655 from Ryex/fix/json-parsing-validator-buffer-reset

fix(net/validators): ensure buffers are cleared and reset;
This commit is contained in:
Tayou 2024-07-18 09:11:29 +02:00 committed by GitHub
commit dcc58c8b75
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 15 additions and 3 deletions

View File

@ -30,13 +30,21 @@ class ParsingValidator : public Net::Validator {
virtual ~ParsingValidator() {};
public: /* methods */
bool init(QNetworkRequest&) override { return true; }
bool init(QNetworkRequest&) override
{
m_data.clear();
return true;
}
bool write(QByteArray& data) override
{
this->m_data.append(data);
return true;
}
bool abort() override { return true; }
bool abort() override
{
m_data.clear();
return true;
}
bool validate(QNetworkReply&) override
{
auto fname = m_entity->localFilename();

View File

@ -60,7 +60,11 @@ class ChecksumValidator : public Validator {
return true;
}
auto abort() -> bool override { return true; }
auto abort() -> bool override
{
m_checksum.reset();
return true;
}
auto validate(QNetworkReply&) -> bool override
{