fix(net/validators): ensure buffers are cleared and reset;

Signed-off-by: Rachel Powers <508861+Ryex@users.noreply.github.com>
This commit is contained in:
Rachel Powers 2024-07-17 23:05:45 -07:00
parent 12db1efd20
commit cb65f6dfb5
No known key found for this signature in database
GPG Key ID: E10E321EB160949B
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
{