fix breaking unc path

This commit is contained in:
Jonathan Jenne 2020-05-29 10:53:38 +02:00
parent 8bd6cd63d4
commit 30827fb841

View File

@ -766,36 +766,36 @@ Public Class Windream
Public Function GetNormalizedPath(Path As String) As String
Dim oNormalizedPath = GetCleanedPath(Path)
Try
'If UsesDriveLetter Then
' Remove Driveletter eg. W:\
' Remove Driveletter, eg. W:\
If oNormalizedPath.StartsWith($"{ClientDriveLetter}:\") Then
_logger.Debug($"Replacing ClientDriveLetter: [{ClientDriveLetter}]")
oNormalizedPath = oNormalizedPath.Substring(ClientDriveLetter.Length + 2)
End If
'Else
' Remove Windream Base Path, eg. \\windream\objects\
If oNormalizedPath.ToLower.StartsWith(ClientBasePath.ToLower) Then
_logger.Debug($"Replacing ClientBasePath: [{ClientBasePath}]")
' Remove Windream Base Path eg. \\windream\objects\
oNormalizedPath = oNormalizedPath.Substring(ClientBasePath.Length - 1)
End If
'End If
oNormalizedPath = oNormalizedPath.Replace("\\", "\")
_logger.Debug($"oNormalizedPath: [{oNormalizedPath}]")
' Convert any forward slashes / and double slashes \\ into backslashes \
' See: https://stackoverflow.com/questions/3144492/how-do-i-get-nets-path-combine-to-convert-forward-slashes-to-backslashes
oNormalizedPath = GetFullPath(oNormalizedPath)
' Handle misconfigured drive-letter
If oNormalizedPath.Contains(":") Then
_logger.Info($"oNormalizedPath still contains a drive name!!")
_logger.Info($"Check Your config ClientDriveLetter [{ClientDriveLetter}] // ClientBasePath [{ClientBasePath}]")
_logger.Warn($"oNormalizedPath still contains a drive name!!")
_logger.Warn($"Check Your config ClientDriveLetter [{ClientDriveLetter}] // ClientBasePath [{ClientBasePath}]")
oNormalizedPath = oNormalizedPath.Substring(3)
_logger.Debug($"oNormalizedPath after Substring: [{oNormalizedPath}]")
End If
_logger.Debug($"oNormalizedPath: [{oNormalizedPath}]")
Return oNormalizedPath
Catch ex As Exception
_logger.Warn($"Unexpected error in GetNormalizedPath - oNormalizedPath [{oNormalizedPath}] - Error: [{ex.Message}]")
Return ""
End Try
End Function
''' <summary>