diff options
author | Kai Pastor <dg0yt@darc.de> | 2020-10-15 07:48:49 +0200 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2020-12-02 08:06:31 +0000 |
commit | 33693a928986006d79c1ee743733cde5966ac402 (patch) | |
tree | 3eb4cb6868d9e992ae48c47e7eb140bb7a66c9a4 | |
parent | 6c462cdcfc9fcca9c060fce034c3e3507d8830b6 (diff) |
Clamp registered collection time-stamp to SOURCE_DATE_EPOCH if set
Task-number: QTBUG-62697
Change-Id: I73cc41db9c57d050783e963896f9696c294126c3
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
(cherry picked from commit b463cd691b533ee31d602b2226b90d3c528b6a94)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r-- | src/assistant/help/qhelpcollectionhandler.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/assistant/help/qhelpcollectionhandler.cpp b/src/assistant/help/qhelpcollectionhandler.cpp index 69782d45f..d7b319d19 100644 --- a/src/assistant/help/qhelpcollectionhandler.cpp +++ b/src/assistant/help/qhelpcollectionhandler.cpp @@ -2197,7 +2197,15 @@ bool QHelpCollectionHandler::registerIndexTable(const QHelpDBReader::IndexTable m_query->addBindValue(fileName); const QFileInfo fi(absoluteDocPath(fileName)); m_query->addBindValue(fi.size()); - m_query->addBindValue(fi.lastModified().toString(Qt::ISODate)); + QDateTime lastModified = fi.lastModified(); + if (qEnvironmentVariableIsSet("SOURCE_DATE_EPOCH")) { + const QString sourceDateEpochStr = qEnvironmentVariable("SOURCE_DATE_EPOCH"); + bool ok; + const qlonglong sourceDateEpoch = sourceDateEpochStr.toLongLong(&ok); + if (ok && sourceDateEpoch < lastModified.toSecsSinceEpoch()) + lastModified.setSecsSinceEpoch(sourceDateEpoch); + } + m_query->addBindValue(lastModified.toString(Qt::ISODate)); if (!m_query->exec()) return false; |