return checksum_header.startsWith("SHA")
|| checksum_header.startsWith("MD5:");
};
+ Q_ASSERT(_item->_modtime > 0);
if (_item->_instruction == CSYNC_INSTRUCTION_CONFLICT
&& _item->_size == _item->_previousSize
&& !_item->_checksumHeader.isEmpty()
// Apply the server mtime locally if necessary, ensuring the journal
// and local mtimes end up identical
auto fn = propagator()->fullLocalPath(_item->_file);
+ Q_ASSERT(_item->_modtime > 0);
if (_item->_modtime != _item->_previousModtime) {
+ Q_ASSERT(_item->_modtime > 0);
FileSystem::setModTime(fn, _item->_modtime);
emit propagator()->touchedFile(fn);
}
_item->_modtime = FileSystem::getModTime(fn);
+ Q_ASSERT(_item->_modtime > 0);
updateMetadata(/*isConflict=*/false);
return;
}
// It is possible that the file was modified on the server since we did the discovery phase
// so make sure we have the up-to-date time
_item->_modtime = job->lastModified();
+ Q_ASSERT(_item->_modtime > 0);
}
_tmpFile.close();
return;
}
+ Q_ASSERT(_item->_modtime > 0);
FileSystem::setModTime(_tmpFile.fileName(), _item->_modtime);
// We need to fetch the time again because some file systems such as FAT have worse than a second
// Accuracy, and we really need the time from the file system. (#3103)
_item->_modtime = FileSystem::getModTime(_tmpFile.fileName());
+ Q_ASSERT(_item->_modtime > 0);
bool previousFileExists = FileSystem::fileExists(fn);
if (previousFileExists) {
}
_item->_file = _item->_renameTarget;
_item->_modtime = FileSystem::getModTime(newFilePathAbsolute);
+ Q_ASSERT(_item->_modtime > 0);
}
SyncJournalFileRecord parentRec;
// and not the _fileToUpload because we are checking the original file, not there
// probably temporary one.
_item->_modtime = FileSystem::getModTime(filePath);
+ Q_ASSERT(_item->_modtime > 0);
const QByteArray checksumType = propagator()->account()->capabilities().preferredUploadChecksumType();
if (!FileSystem::fileExists(fullFilePath)) {
return slotOnErrorStartFolderUnlock(SyncFileItem::SoftError, tr("File Removed (start upload) %1").arg(fullFilePath));
}
+ Q_ASSERT(_item->_modtime > 0);
time_t prevModtime = _item->_modtime; // the _item value was set in PropagateUploadFile::start()
// but a potential checksum calculation could have taken some time during which the file could
// have been changed again, so better check again here.
_item->_modtime = FileSystem::getModTime(originalFilePath);
+ Q_ASSERT(_item->_modtime > 0);
if (prevModtime != _item->_modtime) {
propagator()->_anotherSyncNeeded = true;
qDebug() << "prevModtime" << prevModtime << "Curr" << _item->_modtime;
info._file = _item->_file;
info._url = path;
info._modtime = _item->_modtime;
+ Q_ASSERT(_item->_modtime > 0);
info._fileSize = _item->_size;
propagator()->_journal->setPollInfo(info);
propagator()->_journal->commit("add poll info");
{
QMap<QByteArray, QByteArray> headers;
headers[QByteArrayLiteral("Content-Type")] = QByteArrayLiteral("application/octet-stream");
+ Q_ASSERT(_item->_modtime > 0);
headers[QByteArrayLiteral("X-OC-Mtime")] = QByteArray::number(qint64(_item->_modtime));
if (qEnvironmentVariableIntValue("OWNCLOUD_LAZYOPS"))
headers[QByteArrayLiteral("OC-LazyOps")] = QByteArrayLiteral("true");
propagator()->_activeJobList.append(this);
const SyncJournalDb::UploadInfo progressInfo = propagator()->_journal->getUploadInfo(_item->_file);
+ Q_ASSERT(_item->_modtime > 0);
if (progressInfo._valid && progressInfo.isChunked() && progressInfo._modtime == _item->_modtime
&& progressInfo._size == _item->_size) {
_transferId = progressInfo._transferid;
void PropagateUploadFileNG::startNewUpload()
{
ASSERT(propagator()->_activeJobList.count(this) == 1);
+ Q_ASSERT(_item->_modtime > 0);
_transferId = uint(Utility::rand() ^ uint(_item->_modtime) ^ (uint(_fileToUpload._size) << 16) ^ qHash(_fileToUpload._file));
_sent = 0;
_currentChunk = 0;
SyncJournalDb::UploadInfo pi;
pi._valid = true;
pi._transferid = _transferId;
+ Q_ASSERT(_item->_modtime > 0);
pi._modtime = _item->_modtime;
pi._contentChecksum = _item->_checksumHeader;
pi._size = _item->_size;
}
// Check whether the file changed since discovery - this acts on the original file.
+ Q_ASSERT(_item->_modtime > 0);
if (!FileSystem::verifyFileUnchanged(fullFilePath, _item->_size, _item->_modtime)) {
propagator()->_anotherSyncNeeded = true;
if (!_finished) {
{
_chunkCount = int(std::ceil(_fileToUpload._size / double(chunkSize())));
_startChunk = 0;
+ Q_ASSERT(_item->_modtime > 0);
_transferId = uint(Utility::rand()) ^ uint(_item->_modtime) ^ (uint(_fileToUpload._size) << 16);
const SyncJournalDb::UploadInfo progressInfo = propagator()->_journal->getUploadInfo(_item->_file);
+ Q_ASSERT(_item->_modtime > 0);
if (progressInfo._valid && progressInfo.isChunked() && progressInfo._modtime == _item->_modtime && progressInfo._size == _item->_size
&& (progressInfo._contentChecksum == _item->_checksumHeader || progressInfo._contentChecksum.isEmpty() || _item->_checksumHeader.isEmpty())) {
_startChunk = progressInfo._chunk;
pi._valid = true;
pi._chunk = 0;
pi._transferid = 0; // We set a null transfer id because it is not chunked.
+ Q_ASSERT(_item->_modtime > 0);
pi._modtime = _item->_modtime;
pi._errorCount = 0;
pi._contentChecksum = _item->_checksumHeader;
}
// Check whether the file changed since discovery. the file check here is the original and not the temprary.
+ Q_ASSERT(_item->_modtime > 0);
if (!FileSystem::verifyFileUnchanged(fullFilePath, _item->_size, _item->_modtime)) {
propagator()->_anotherSyncNeeded = true;
if (!_finished) {
}
pi._chunk = (currentChunk + _startChunk + 1) % _chunkCount; // next chunk to start with
pi._transferid = _transferId;
+ Q_ASSERT(_item->_modtime > 0);
pi._modtime = _item->_modtime;
pi._errorCount = 0; // successful chunk upload resets
pi._contentChecksum = _item->_checksumHeader;