From 4d2b9e3a4ad7827588514e3341dcb86ce5d6e0a4 Mon Sep 17 00:00:00 2001 From: Kevin Jump Date: Thu, 14 May 2020 12:41:37 +0100 Subject: [PATCH] Expand short paths, when resolving to absolute path values. --- uSync8.BackOffice/Services/SyncFileService.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/uSync8.BackOffice/Services/SyncFileService.cs b/uSync8.BackOffice/Services/SyncFileService.cs index daee0064..95913034 100644 --- a/uSync8.BackOffice/Services/SyncFileService.cs +++ b/uSync8.BackOffice/Services/SyncFileService.cs @@ -42,7 +42,7 @@ private void BackOfficeConfig_Reloaded(uSyncSettings settings) public string GetAbsPath(string path) { if (IsLocalPath(path)) return CleanLocalPath(path); - return IOHelper.MapPath(path.TrimStart('/')); + return CleanLocalPath(IOHelper.MapPath(path.TrimStart('/'))); } /// @@ -73,8 +73,11 @@ private bool IsDirectorySeparator(char c) private bool IsValidDriveChar(char value) => ((value >= 'A' && value <= 'Z') || (value >= 'a' && value <= 'z')); + /// + /// clean up the local path, and full expand any short file names + /// private string CleanLocalPath(string path) - => path.Replace(Path.AltDirectorySeparatorChar, Path.DirectorySeparatorChar); + => Path.GetFullPath(path.Replace(Path.AltDirectorySeparatorChar, Path.DirectorySeparatorChar)); public bool FileExists(string path) => File.Exists(GetAbsPath(path));