(!_csync_mtime_equal(fs->modtime, base._modtime)
// zero size in statedb can happen during migration
|| (base._fileSize != 0 && fs->size != base._fileSize))) {
-
- // Checksum comparison at this stage is only enabled for .eml files,
- // check #4754 #4755
- bool isEmlFile = csync_fnmatch("*.eml", fs->path, FNM_CASEFOLD) == 0;
- if (isEmlFile && fs->size == base._fileSize && !base._checksumHeader.isEmpty()) {
- if (ctx->callbacks.checksum_hook) {
- fs->checksumHeader = ctx->callbacks.checksum_hook(
- _rel_to_abs(ctx, fs->path), base._checksumHeader,
- ctx->callbacks.checksum_userdata);
- }
- bool checksumIdentical = false;
- if (!fs->checksumHeader.isEmpty()) {
- checksumIdentical = fs->checksumHeader == base._checksumHeader;
- }
- if (checksumIdentical) {
- qCInfo(lcUpdate, "NOTE: Checksums are identical, file did not actually change: %s", fs->path.constData());
- fs->instruction = CSYNC_INSTRUCTION_UPDATE_METADATA;
- goto out;
- }
- }
+ // PORTED: EML
// Preserve the EVAL flag later on if the type has changed.
if (base._type != fs->type) {
#include <set>
#include <QDirIterator>
#include "vio/csync_vio_local.h"
+#include "common/checksums.h"
namespace OCC {
item->_instruction = CSYNC_INSTRUCTION_NEW;
item->_direction = SyncFileItem::Up;
// TODO! rename;
+ item->_checksumHeader.clear();
item->_size = localEntry.size;
item->_modtime = localEntry.modtime;
item->_type = localEntry.isDirectory ? ItemTypeDirectory : ItemTypeFile;
} else {
item->_instruction = CSYNC_INSTRUCTION_SYNC;
item->_direction = SyncFileItem::Up;
+ item->_checksumHeader.clear();
item->_size = localEntry.size;
item->_modtime = localEntry.modtime;
item->_previousSize = serverEntry.size;
item->_previousModtime = serverEntry.modtime;
_childModified = true;
+
+ // Checksum comparison at this stage is only enabled for .eml files,
+ // check #4754 #4755
+ bool isEmlFile = path.endsWith(QLatin1String(".eml"), Qt::CaseInsensitive);
+ if (isEmlFile && dbEntry._fileSize == localEntry.size && !dbEntry._checksumHeader.isEmpty()) {
+ QByteArray type = parseChecksumHeaderType(dbEntry._checksumHeader);
+ if (!type.isEmpty()) {
+ // TODO: compute async?
+ QByteArray checksum = ComputeChecksum::computeNow(_propagator->_localDir + path, type);
+ if (!checksum.isEmpty()) {
+ item->_checksumHeader = makeChecksumHeader(type, checksum);
+ if (item->_checksumHeader == dbEntry._checksumHeader) {
+ qCDebug(lcDisco) << "NOTE: Checksums are identical, file did not actually change: " << path;
+ item->_instruction = CSYNC_INSTRUCTION_UPDATE_METADATA;
+ }
+ }
+ }
+ }
}
} else if (!serverModified) {
item->_instruction = CSYNC_INSTRUCTION_REMOVE;
connect(job, &ProcessDirectoryJob::finished, this, &ProcessDirectoryJob::subJobFinished);
_queuedJobs.push_back(job);
} else {
- emit itemDiscovered(item);
+ if (item->_instruction != CSYNC_INSTRUCTION_NONE)
+ emit itemDiscovered(item);
}
}