Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/desktop.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoralex-z <blackslayer4@gmail.com>2021-12-20 15:59:08 +0300
committerallexzander (Rebase PR Action) <allexzander@users.noreply.github.com>2022-01-11 16:37:09 +0300
commit190d278fd4302cbb963338b4e224b326834ef0e2 (patch)
treeeffaa94fc8d61c58d8b0364a058fe87bfac93ab1 /src/common
parent5b0e2d8ed071d6fb7d0ff9152c089df093740bee (diff)
Checksum validation PropagateDownload unit tests.
Signed-off-by: alex-z <blackslayer4@gmail.com>
Diffstat (limited to 'src/common')
-rw-r--r--src/common/checksums.cpp8
-rw-r--r--src/common/checksums.h5
2 files changed, 9 insertions, 4 deletions
diff --git a/src/common/checksums.cpp b/src/common/checksums.cpp
index 5cef55bfb..a298e5d2f 100644
--- a/src/common/checksums.cpp
+++ b/src/common/checksums.cpp
@@ -337,7 +337,7 @@ ComputeChecksum *ValidateChecksumHeader::prepareStart(const QByteArray &checksum
if (!parseChecksumHeader(checksumHeader, &_expectedChecksumType, &_expectedChecksum)) {
qCWarning(lcChecksums) << "Checksum header malformed:" << checksumHeader;
- emit validationFailed(tr("The checksum header is malformed."), ChecksumHeaderMalformed);
+ emit validationFailed(tr("The checksum header is malformed."), _calculatedChecksumType, _calculatedChecksum, ChecksumHeaderMalformed);
return nullptr;
}
@@ -377,11 +377,13 @@ void ValidateChecksumHeader::slotChecksumCalculated(const QByteArray &checksumTy
_calculatedChecksum = checksum;
if (checksumType != _expectedChecksumType) {
- emit validationFailed(tr("The checksum header contained an unknown checksum type \"%1\"").arg(QString::fromLatin1(_expectedChecksumType)), ChecksumTypeUnknown);
+ emit validationFailed(tr("The checksum header contained an unknown checksum type \"%1\"").arg(QString::fromLatin1(_expectedChecksumType)),
+ _calculatedChecksumType, _calculatedChecksum, ChecksumTypeUnknown);
return;
}
if (checksum != _expectedChecksum) {
- emit validationFailed(tr(R"(The downloaded file does not match the checksum, it will be resumed. "%1" != "%2")").arg(QString::fromUtf8(_expectedChecksum), QString::fromUtf8(checksum)), ChecksumMismatch);
+ emit validationFailed(tr(R"(The downloaded file does not match the checksum, it will be resumed. "%1" != "%2")").arg(QString::fromUtf8(_expectedChecksum), QString::fromUtf8(checksum)),
+ _calculatedChecksumType, _calculatedChecksum, ChecksumMismatch);
return;
}
emit validated(checksumType, checksum);
diff --git a/src/common/checksums.h b/src/common/checksums.h
index 80716040c..8ade282c7 100644
--- a/src/common/checksums.h
+++ b/src/common/checksums.h
@@ -146,6 +146,8 @@ public:
ChecksumTypeUnknown,
ChecksumMismatch,
};
+ Q_ENUM(FailureReason)
+
explicit ValidateChecksumHeader(QObject *parent = nullptr);
/**
@@ -172,7 +174,8 @@ public:
signals:
void validated(const QByteArray &checksumType, const QByteArray &checksum);
- void validationFailed(const QString &errMsg, FailureReason reason);
+ void validationFailed(const QString &errMsg, const QByteArray &calculatedChecksumType,
+ const QByteArray &calculatedChecksum, ValidateChecksumHeader::FailureReason reason);
private slots:
void slotChecksumCalculated(const QByteArray &checksumType, const QByteArray &checksum);