Skip to content

Commit cd3d9ba

Browse files
committed
fix: Potentially catch SSH downloads that don't happen due to bad config.
1 parent f283030 commit cd3d9ba

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

RemoteFile/RemoteHandlers/SSHHandler.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,8 +260,14 @@ public override byte[] DownloadCertificateFile(string path)
260260

261261
bool scpError = false;
262262

263+
_logger.LogDebug($"Download path: {downloadPath}");
264+
_logger.LogDebug($"IsStoreServerLinux: {IsStoreServerLinux}");
265+
_logger.LogDebug($"FileTransferProtocol: {FileTransferProtocol}");
266+
bool attemptedDownload = false;
267+
263268
if (FileTransferProtocol == ApplicationSettings.FileTransferProtocolEnum.Both || FileTransferProtocol == ApplicationSettings.FileTransferProtocolEnum.SCP)
264269
{
270+
_logger.LogDebug($"Attempting SCP download...");
265271
using (ScpClient client = new ScpClient(Connection))
266272
{
267273
try
@@ -288,6 +294,7 @@ public override byte[] DownloadCertificateFile(string path)
288294
}
289295
finally
290296
{
297+
attemptedDownload = true;
291298
client.Disconnect();
292299
}
293300
}
@@ -317,10 +324,17 @@ public override byte[] DownloadCertificateFile(string path)
317324
}
318325
finally
319326
{
327+
attemptedDownload = true;
320328
client.Disconnect();
321329
}
322330
}
323331
}
332+
if (!attemptedDownload)
333+
{
334+
FileTransferProtocol = ApplicationSettings.FileTransferProtocolEnum.Both;
335+
_logger.LogDebug($"No download attempted. Setting FileTransferProtocol to Both and retrying download.");
336+
return DownloadCertificateFile(path);
337+
}
324338

325339
if (!string.IsNullOrEmpty(ApplicationSettings.SeparateUploadFilePath) && IsStoreServerLinux)
326340
{

0 commit comments

Comments
 (0)