diff --git a/src/libsync/vfs/cfapi/cfapiwrapper.cpp b/src/libsync/vfs/cfapi/cfapiwrapper.cpp index 09fb3764ae..16b9d8f7e3 100644 --- a/src/libsync/vfs/cfapi/cfapiwrapper.cpp +++ b/src/libsync/vfs/cfapi/cfapiwrapper.cpp @@ -643,6 +643,10 @@ OCC::Result OCC::CfApiWrapper::se OCC::Result OCC::CfApiWrapper::createPlaceholderInfo(const QString &path, time_t modtime, qint64 size, const QByteArray &fileId) { + if (modtime <= 0) { + return {QString{"Could not update metadata due to invalid modified time for %1: %2"}.arg(path).arg(modtime)}; + } + const auto fileInfo = QFileInfo(path); const auto localBasePath = QDir::toNativeSeparators(fileInfo.path()).toStdWString(); const auto relativePath = fileInfo.fileName().toStdWString(); @@ -691,6 +695,10 @@ OCC::Result OCC::CfApiWrapper::up { Q_ASSERT(handle); + if (modtime <= 0) { + return {QString{"Could not update metadata due to invalid modified time for %1: %2"}.arg(pathForHandle(handle)).arg(modtime)}; + } + const auto info = replacesPath.isEmpty() ? findPlaceholderInfo(handle) : findPlaceholderInfo(handleForPath(replacesPath)); if (!info) {