From fa69d089cfd4914dd46e19901c6899c719ead086 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Thu, 21 Apr 2016 11:43:44 +0200 Subject: [PATCH] Checksums: remove the downloadChecksumValidationEnabled option Added in previous commit from pull request #4663 As discussed, we do not need this option so no need to introduce a new dependency on the config file in the sync engine --- src/libsync/checksums.cpp | 7 ------- src/libsync/checksums.h | 3 --- src/libsync/configfile.cpp | 12 ------------ src/libsync/configfile.h | 8 -------- src/libsync/propagatedownload.cpp | 3 --- 5 files changed, 33 deletions(-) diff --git a/src/libsync/checksums.cpp b/src/libsync/checksums.cpp index 3a17825ad..af8614951 100644 --- a/src/libsync/checksums.cpp +++ b/src/libsync/checksums.cpp @@ -17,7 +17,6 @@ #include "syncfileitem.h" #include "propagatorjobs.h" #include "account.h" -#include "configfile.h" #include @@ -109,12 +108,6 @@ bool uploadChecksumEnabled() return enabled; } -bool downloadChecksumValidationEnabled() -{ - static bool disabledByConfig = ConfigFile().disableDownloadChecksumValidation(); - return !disabledByConfig; -} - QByteArray contentChecksumType() { static QByteArray type = qgetenv("OWNCLOUD_CONTENT_CHECKSUM_TYPE"); diff --git a/src/libsync/checksums.h b/src/libsync/checksums.h index 670e3c0b4..eb2bd275f 100644 --- a/src/libsync/checksums.h +++ b/src/libsync/checksums.h @@ -34,9 +34,6 @@ bool parseChecksumHeader(const QByteArray& header, QByteArray* type, QByteArray* /// Checks OWNCLOUD_DISABLE_CHECKSUM_UPLOAD bool uploadChecksumEnabled(); -/// Checks disableDownloadChecksumValidation from the config file -bool downloadChecksumValidationEnabled(); - /// Checks OWNCLOUD_CONTENT_CHECKSUM_TYPE (default: SHA1) QByteArray contentChecksumType(); diff --git a/src/libsync/configfile.cpp b/src/libsync/configfile.cpp index 931349a98..acf3d6ad5 100644 --- a/src/libsync/configfile.cpp +++ b/src/libsync/configfile.cpp @@ -52,7 +52,6 @@ static const char updateCheckIntervalC[] = "updateCheckInterval"; static const char geometryC[] = "geometry"; static const char timeoutC[] = "timeout"; static const char chunkSizeC[] = "chunkSize"; -static const char disableDownloadChecksumValidationC[] = "disableDownloadChecksumValidation"; static const char proxyHostC[] = "Proxy/host"; static const char proxyTypeC[] = "Proxy/type"; @@ -129,17 +128,6 @@ quint64 ConfigFile::chunkSize() const return settings.value(QLatin1String(chunkSizeC), 10*1000*1000).toLongLong(); // default to 10 MB } -bool ConfigFile::disableDownloadChecksumValidation() const -{ - QSettings settings(configFile(), QSettings::IniFormat); - - QVariant value = settings.value(QLatin1String(disableDownloadChecksumValidationC)); - if (!value.isValid()) { - return false; - } - return value.toBool(); -} - void ConfigFile::setOptionalDesktopNotifications(bool show) { QSettings settings(configFile(), QSettings::IniFormat); diff --git a/src/libsync/configfile.h b/src/libsync/configfile.h index 361a82b13..cd95f1a0b 100644 --- a/src/libsync/configfile.h +++ b/src/libsync/configfile.h @@ -114,14 +114,6 @@ public: int timeout() const; quint64 chunkSize() const; - /** Whether to disable download checksum validation. - * - * By default (false) received checksums will be validated. This flag - * can disable checksum validation and is intended for debugging purposes - * only. - */ - bool disableDownloadChecksumValidation() const; - void saveGeometry(QWidget *w); void restoreGeometry(QWidget *w); diff --git a/src/libsync/propagatedownload.cpp b/src/libsync/propagatedownload.cpp index 41170b6af..1a9d29971 100644 --- a/src/libsync/propagatedownload.cpp +++ b/src/libsync/propagatedownload.cpp @@ -555,9 +555,6 @@ void PropagateDownloadFileQNAM::slotGetFinished() connect(validator, SIGNAL(validationFailed(QString)), SLOT(slotChecksumFail(QString))); auto checksumHeader = job->reply()->rawHeader(checkSumHeaderC); - if (!downloadChecksumValidationEnabled()) { - checksumHeader.clear(); - } validator->start(_tmpFile.fileName(), checksumHeader); }