Przeglądaj źródła

Issue 2307 – Preserve timestamp when duplicating remote file using SFTP extension copy-data (OpenSSH)

https://winscp.net/tracker/2307

Source commit: 2a1090a9bf935dfcd27605c77b241dff67b9dc2b
Martin Prikryl 1 rok temu
rodzic
commit
156747a433
1 zmienionych plików z 12 dodań i 0 usunięć
  1. 12 0
      source/core/SftpFileSystem.cpp

+ 12 - 0
source/core/SftpFileSystem.cpp

@@ -3970,6 +3970,18 @@ void __fastcall TSFTPFileSystem::CopyFile(
       Packet.AddString(DestRemoteHandle);
       Packet.AddInt64(0);
       SendPacketAndReceiveResponse(&Packet, &Packet, SSH_FXP_STATUS);
+
+      if (DebugAlwaysTrue(File != NULL))
+      {
+        TSFTPPacket PropertiesRequest(SSH_FXP_SETSTAT);
+        AddPathString(PropertiesRequest, NewNameCanonical);
+
+        unsigned short Rights = File->Rights->NumberSet;
+        TDSTMode DSTMode = FTerminal->SessionData->DSTMode;
+        __int64 MTime = ConvertTimestampToUnix(DateTimeToFileTime(File->Modification, DSTMode), DSTMode);
+        PropertiesRequest.AddProperties(&Rights, NULL, NULL, &MTime, NULL, NULL, false, FVersion, FUtfStrings);
+        SendPacketAndReceiveResponse(&PropertiesRequest, &Packet, SSH_FXP_STATUS);
+      }
     }
     __finally
     {