mirror of
https://github.com/nextcloud/desktop.git
synced 2024-10-26 22:35:55 +03:00
Use the servers checksum type by default
This commit is contained in:
parent
8c3749cbe2
commit
c1a91e91e7
5 changed files with 5 additions and 15 deletions
|
@ -189,15 +189,6 @@ bool uploadChecksumEnabled()
|
|||
return enabled;
|
||||
}
|
||||
|
||||
QByteArray contentChecksumType()
|
||||
{
|
||||
static QByteArray type = qgetenv("OWNCLOUD_CONTENT_CHECKSUM_TYPE");
|
||||
if (type.isNull()) { // can set to "" to disable checksumming
|
||||
type = "SHA1";
|
||||
}
|
||||
return type;
|
||||
}
|
||||
|
||||
static bool checksumComputationEnabled()
|
||||
{
|
||||
static bool enabled = qEnvironmentVariableIsEmpty("OWNCLOUD_DISABLE_CHECKSUM_COMPUTATIONS");
|
||||
|
|
|
@ -65,9 +65,6 @@ OCSYNC_EXPORT QByteArray parseChecksumHeaderType(const QByteArray &header);
|
|||
/// Checks OWNCLOUD_DISABLE_CHECKSUM_UPLOAD
|
||||
OCSYNC_EXPORT bool uploadChecksumEnabled();
|
||||
|
||||
/// Checks OWNCLOUD_CONTENT_CHECKSUM_TYPE (default: SHA1)
|
||||
OCSYNC_EXPORT QByteArray contentChecksumType();
|
||||
|
||||
// Exported functions for the tests.
|
||||
QByteArray OCSYNC_EXPORT calcMd5(QIODevice *device);
|
||||
QByteArray OCSYNC_EXPORT calcSha1(QIODevice *device);
|
||||
|
|
|
@ -150,7 +150,9 @@ QList<QByteArray> Capabilities::supportedChecksumTypes() const
|
|||
|
||||
QByteArray Capabilities::preferredUploadChecksumType() const
|
||||
{
|
||||
return _capabilities["checksums"].toMap()["preferredUploadType"].toByteArray();
|
||||
return qEnvironmentVariable("OWNCLOUD_CONTENT_CHECKSUM_TYPE",
|
||||
_capabilities.value(QStringLiteral("checksums")).toMap()
|
||||
.value(QStringLiteral("preferredUploadType"), QStringLiteral("SHA1")).toString()).toUtf8();
|
||||
}
|
||||
|
||||
QByteArray Capabilities::uploadChecksumType() const
|
||||
|
|
|
@ -909,7 +909,7 @@ namespace { // Anonymous namespace for the recall feature
|
|||
|
||||
void PropagateDownloadFile::transmissionChecksumValidated(const QByteArray &checksumType, const QByteArray &checksum)
|
||||
{
|
||||
const auto theContentChecksumType = contentChecksumType();
|
||||
const QByteArray theContentChecksumType = propagator()->account()->capabilities().preferredUploadChecksumType();
|
||||
|
||||
// Reuse transmission checksum as content checksum.
|
||||
//
|
||||
|
|
|
@ -349,7 +349,7 @@ void PropagateUploadFileCommon::slotComputeContentChecksum()
|
|||
// probably temporary one.
|
||||
_item->_modtime = FileSystem::getModTime(filePath);
|
||||
|
||||
QByteArray checksumType = contentChecksumType();
|
||||
const QByteArray checksumType = propagator()->account()->capabilities().preferredUploadChecksumType();
|
||||
|
||||
// Maybe the discovery already computed the checksum?
|
||||
// Should I compute the checksum of the original (_item->_file)
|
||||
|
|
Loading…
Reference in a new issue