Print checksum on mismatch
authorHannah von Reth <hannah.vonreth@owncloud.com>
Fri, 14 Aug 2020 13:40:14 +0000 (15:40 +0200)
committerKevin Ottens <kevin.ottens@nextcloud.com>
Tue, 15 Dec 2020 09:59:18 +0000 (10:59 +0100)
src/common/checksums.cpp
test/testchecksumvalidator.cpp

index aef426813270d59b2b2c03662ef23c56bdf08eef..60c8c9b775b642bf2fccb03f163b4dca802b5c8d 100644 (file)
@@ -357,7 +357,7 @@ void ValidateChecksumHeader::slotChecksumCalculated(const QByteArray &checksumTy
         return;
     }
     if (checksum != _expectedChecksum) {
-        emit validationFailed(tr("The downloaded file does not match the checksum, it will be resumed."));
+        emit validationFailed(tr("The downloaded file does not match the checksum, it will be resumed. '%1' != '%2'").arg(QString::fromUtf8(_expectedChecksum), QString::fromUtf8(checksum)));
         return;
     }
     emit validated(checksumType, checksum);
index 5c9c3f37b95a6270cf981e2cb653e1db717633f2..93af94bdeb1bff77efd1b031bc07e2b8ab8c7eb2 100644 (file)
@@ -43,7 +43,7 @@ using namespace OCC::Utility;
     }
 
     void slotDownError( const QString& errMsg ) {
-         QVERIFY(_expectedError == errMsg );
+         QCOMPARE(_expectedError, errMsg);
          _errorSeen = true;
     }
 
@@ -196,7 +196,7 @@ using namespace OCC::Utility;
 
         QTRY_VERIFY(_successDown);
 
-        _expectedError = QLatin1String("The downloaded file does not match the checksum, it will be resumed.");
+        _expectedError = QStringLiteral("The downloaded file does not match the checksum, it will be resumed. '543345' != '%1'").arg(QString::fromUtf8(_expected));
         _errorSeen = false;
         file->seek(0);
         vali->start(_testfile, "Adler32:543345");