return enabled;
}
+QByteArray contentChecksumType()
+{
+ static QByteArray type = qgetenv("OWNCLOUD_CONTENT_CHECKSUM_TYPE");
+ if (!type.isNull()) { // can set to "" to disable checksumming
+ return type;
+ }
+ return "SHA1";
+}
+
ComputeChecksum::ComputeChecksum(QObject* parent)
: QObject(parent)
{
/// Checks OWNCLOUD_DISABLE_CHECKSUM_DOWNLOAD
bool downloadChecksumEnabled();
+/// Checks OWNCLOUD_CONTENT_CHECKSUM_TYPE (default: SHA1)
+QByteArray contentChecksumType();
+
+
/**
* Computes the checksum of a file.
* \ingroup libsync
_stopWatch.start();
- QByteArray contentChecksumType;
- // We currently only do content checksums for the particular .eml case
- // This should be done more generally in the future!
- if (filePath.endsWith(QLatin1String(".eml"), Qt::CaseInsensitive)) {
- contentChecksumType = "MD5";
- }
+ QByteArray checksumType = contentChecksumType();
// Maybe the discovery already computed the checksum?
- if (_item->_contentChecksumType == contentChecksumType
+ if (_item->_contentChecksumType == checksumType
&& !_item->_contentChecksum.isEmpty()) {
- slotComputeTransmissionChecksum(contentChecksumType, _item->_contentChecksum);
+ slotComputeTransmissionChecksum(checksumType, _item->_contentChecksum);
return;
}
// Compute the content checksum.
auto computeChecksum = new ComputeChecksum(this);
- computeChecksum->setChecksumType(contentChecksumType);
+ computeChecksum->setChecksumType(checksumType);
connect(computeChecksum, SIGNAL(done(QByteArray,QByteArray)),
SLOT(slotComputeTransmissionChecksum(QByteArray,QByteArray)));