From a2f97e2fad708c93c8ac4a51554efa526e1c1e6c Mon Sep 17 00:00:00 2001 From: matejskubic <839965+matejskubic@users.noreply.github.com> Date: Fri, 24 Apr 2020 13:11:03 +0200 Subject: [PATCH] Fix processing empty directories --- Sync-Pootle.psm1 | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Sync-Pootle.psm1 b/Sync-Pootle.psm1 index 6bd804e..0bdb820 100644 --- a/Sync-Pootle.psm1 +++ b/Sync-Pootle.psm1 @@ -196,6 +196,10 @@ function getRemoteFiles() function sftpListDirectoryRecursive($remoteDir) { $result = [System.Collections.Generic.List[string]]::new() + if (!$sftp.Exists($remoteDir)) + { + return + } $files = $sftp.ListDirectory($remoteDir) $files |% { #$file = $files[2] @@ -256,6 +260,10 @@ function transferTranslations([System.IO.FileInfo[]]$files, [ValidateSet("upload $uploadFoldersToSync = New-Object "System.Collections.Generic.Dictionary[System.IO.DirectoryInfo, string]" [System.IO.DirectoryInfo]$di = $exportXlifRootTo + if (!$files) + { + return + } $files | % { $fi = $_ $relPath = $fi.Directory.FullName.Remove(0, $di.FullName.Length)