43 lines
1.7 KiB
Diff
43 lines
1.7 KiB
Diff
|
From 5e791ef216c230efc15b853c08b21d41eca65e0c Mon Sep 17 00:00:00 2001
|
||
|
From: Wolfgang Bauer <wbauer@tmo.at>
|
||
|
Date: Fri, 21 Jun 2019 15:30:48 +0200
|
||
|
Subject: [copyjob] Only set modification time if the kio-slave provided it
|
||
|
|
||
|
If the slave didn't pass a modification time (e.g. the http slave
|
||
|
doesn't), it was set to -1, resulting in setting a wrong modification
|
||
|
time for the destination file in copyNextFile() later on because that
|
||
|
case wasn't checked.
|
||
|
|
||
|
So only set info.mtime when the slave actually provided a value.
|
||
|
|
||
|
There's no need for further checks later in copyNextFile() (where
|
||
|
FileCopyJob::setModificationTime() is called) because FileCopyJob checks
|
||
|
for validity anyway.
|
||
|
|
||
|
BUG: 374420
|
||
|
FIXED-IN: 5.60.0
|
||
|
Differential Revision: https://phabricator.kde.org/D21955
|
||
|
---
|
||
|
src/core/copyjob.cpp | 5 ++++-
|
||
|
1 file changed, 4 insertions(+), 1 deletion(-)
|
||
|
|
||
|
diff --git a/src/core/copyjob.cpp b/src/core/copyjob.cpp
|
||
|
index 7288a26..0a14edc 100644
|
||
|
--- a/src/core/copyjob.cpp
|
||
|
+++ b/src/core/copyjob.cpp
|
||
|
@@ -664,7 +664,10 @@ void CopyJobPrivate::addCopyInfoFromUDSEntry(const UDSEntry &entry, const QUrl &
|
||
|
{
|
||
|
struct CopyInfo info;
|
||
|
info.permissions = entry.numberValue(KIO::UDSEntry::UDS_ACCESS, -1);
|
||
|
- info.mtime = QDateTime::fromMSecsSinceEpoch(1000 * entry.numberValue(KIO::UDSEntry::UDS_MODIFICATION_TIME, -1), Qt::UTC);
|
||
|
+ const auto timeVal = entry.numberValue(KIO::UDSEntry::UDS_MODIFICATION_TIME, -1);
|
||
|
+ if (timeVal != -1) {
|
||
|
+ info.mtime = QDateTime::fromMSecsSinceEpoch(1000 * timeVal, Qt::UTC);
|
||
|
+ }
|
||
|
info.ctime = QDateTime::fromMSecsSinceEpoch(1000 * entry.numberValue(KIO::UDSEntry::UDS_CREATION_TIME, -1), Qt::UTC);
|
||
|
info.size = static_cast<KIO::filesize_t>(entry.numberValue(KIO::UDSEntry::UDS_SIZE, -1));
|
||
|
|
||
|
--
|
||
|
cgit v1.1
|
||
|
|