You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Files with a modification time of less than 0 do usually not make sense
(and afaik the server doesn't accept them either).
--> attempt to update the modification time to _Time.now_ while
propagating
side note: I ran into this because KArchive/Ark(?) didn't consider the
extra time attributes on entries for a certain zip file, so it instead
used the standard time value of each zip entry which was set to <= 1980
for files and < 1970 for directories...
Signed-off-by: Jyrki Gadinger <nilsding@nilsding.org>
slotOnErrorStartFolderUnlock(item, SyncFileItem::NormalError, tr("File %1 has invalid modified time. Do not upload to the server.").arg(QDir::toNativeSeparators(item->_file)), ErrorCategory::GenericError);
200
-
checkPropagationIsDone();
201
-
return;
198
+
constauto now = QDateTime::currentSecsSinceEpoch();
199
+
qCInfo(lcPropagateUpload) << "File" << item->_file << "has invalid modification time of" << item->_modtime << "-- trying to update it to" << now;
200
+
if (FileSystem::setModTime(newFilePathAbsolute, now)) {
201
+
item->_modtime = now;
202
+
} else {
203
+
qCWarning(lcPropagateUpload) << "Could not update modification time for" << item->_file;
204
+
_pendingChecksumFiles.remove(item->_file);
205
+
slotOnErrorStartFolderUnlock(item, SyncFileItem::NormalError, tr("File %1 has invalid modified time. Do not upload to the server.").arg(QDir::toNativeSeparators(item->_file)), ErrorCategory::GenericError);
slotOnErrorStartFolderUnlock(item, SyncFileItem::NormalError, tr("File %1 has invalid modification time. Do not upload to the server.").arg(QDir::toNativeSeparators(item->_file)), ErrorCategory::GenericError);
336
-
checkPropagationIsDone();
337
-
return;
342
+
constauto now = QDateTime::currentSecsSinceEpoch();
343
+
qCInfo(lcPropagateUpload) << "File" << item->_file << "has invalid modification time of" << item->_modtime << "-- trying to update it to" << now;
344
+
if (FileSystem::setModTime(originalFilePath, now)) {
345
+
item->_modtime = now;
346
+
} else {
347
+
qCWarning(lcPropagateUpload) << "Could not update modification time for" << item->_file;
348
+
_pendingChecksumFiles.remove(item->_file);
349
+
slotOnErrorStartFolderUnlock(item, SyncFileItem::NormalError, tr("File %1 has invalid modification time. Do not upload to the server.").arg(QDir::toNativeSeparators(item->_file)), ErrorCategory::GenericError);
350
+
checkPropagationIsDone();
351
+
return;
352
+
}
338
353
}
339
-
if (prevModtime != item->_modtime) {
354
+
if (prevModtime > 0 && prevModtime != item->_modtime) {
slotOnErrorStartFolderUnlock(SyncFileItem::NormalError, tr("File %1 has invalid modification time. Do not upload to the server.").arg(QDir::toNativeSeparators(_item->_file)));
328
-
return;
327
+
constauto now = QDateTime::currentSecsSinceEpoch();
328
+
qCInfo(lcPropagateUpload) << "File" << _item->_file << "has invalid modification time of" << _item->_modtime << "-- trying to update it to" << now;
329
+
if (FileSystem::setModTime(filePath, now)) {
330
+
_item->_modtime = now;
331
+
} else {
332
+
qCWarning(lcPropagateUpload) << "Could not update modification time for" << _item->_file;
333
+
slotOnErrorStartFolderUnlock(SyncFileItem::NormalError, tr("File %1 has invalid modification time. Do not upload to the server.").arg(QDir::toNativeSeparators(_item->_file)));
0 commit comments