mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-26 23:28:14 +03:00
Checksum: Add env variables to disable #3735
This commit is contained in:
parent
dff37e11eb
commit
f1b500d3e0
4 changed files with 26 additions and 1 deletions
|
@ -537,7 +537,11 @@ void PropagateDownloadFileQNAM::slotGetFinished()
|
|||
ValidateChecksumHeader *validator = new ValidateChecksumHeader(this);
|
||||
connect(validator, SIGNAL(validated(QByteArray)), this, SLOT(downloadFinished(QByteArray)));
|
||||
connect(validator, SIGNAL(validationFailed(QString)), this, SLOT(slotChecksumFail(QString)));
|
||||
validator->start(_tmpFile.fileName(), job->reply()->rawHeader(checkSumHeaderC));
|
||||
auto checksumHeader = job->reply()->rawHeader(checkSumHeaderC);
|
||||
if (!downloadChecksumEnabled()) {
|
||||
checksumHeader.clear();
|
||||
}
|
||||
validator->start(_tmpFile.fileName(), checksumHeader);
|
||||
}
|
||||
|
||||
void PropagateDownloadFileQNAM::slotChecksumFail( const QString& errMsg )
|
||||
|
|
|
@ -237,6 +237,9 @@ void PropagateUploadFileQNAM::start()
|
|||
computeChecksum->setChecksumType(supportedChecksumTypes.first());
|
||||
}
|
||||
}
|
||||
if (!uploadChecksumEnabled()) {
|
||||
computeChecksum->setChecksumType(QByteArray());
|
||||
}
|
||||
|
||||
connect(computeChecksum, SIGNAL(done(QByteArray,QByteArray)),
|
||||
SLOT(slotStartUpload(QByteArray,QByteArray)));
|
||||
|
|
|
@ -49,6 +49,18 @@ bool parseChecksumHeader(const QByteArray& header, QByteArray* type, QByteArray*
|
|||
return true;
|
||||
}
|
||||
|
||||
bool uploadChecksumEnabled()
|
||||
{
|
||||
static bool enabled = qgetenv("OWNCLOUD_DISABLE_CHECKSUM_UPLOAD").isEmpty();
|
||||
return enabled;
|
||||
}
|
||||
|
||||
bool downloadChecksumEnabled()
|
||||
{
|
||||
static bool enabled = qgetenv("OWNCLOUD_DISABLE_CHECKSUM_DOWNLOAD").isEmpty();
|
||||
return enabled;
|
||||
}
|
||||
|
||||
ComputeChecksum::ComputeChecksum(QObject* parent)
|
||||
: QObject(parent)
|
||||
{
|
||||
|
|
|
@ -29,6 +29,12 @@ QByteArray makeChecksumHeader(const QByteArray& checksumType, const QByteArray&
|
|||
/// Parses a checksum header
|
||||
bool parseChecksumHeader(const QByteArray& header, QByteArray* type, QByteArray* checksum);
|
||||
|
||||
/// Checks OWNCLOUD_DISABLE_CHECKSUM_UPLOAD
|
||||
bool uploadChecksumEnabled();
|
||||
|
||||
/// Checks OWNCLOUD_DISABLE_CHECKSUM_DOWNLOAD
|
||||
bool downloadChecksumEnabled();
|
||||
|
||||
/**
|
||||
* Computes the checksum of a file.
|
||||
* \ingroup libsync
|
||||
|
|
Loading…
Reference in a new issue