Fix: les chemins pointant vers un endroit non-local font planter le scan qui retourne zero bytes analysés
This commit is contained in:
+9
-1
@@ -782,8 +782,16 @@ function Invoke-FilerScan {
|
||||
# Canonicalise the root once. Every child path is derived from this
|
||||
# string, and every length compared against -MaxPathLength is measured on
|
||||
# it, so an 8.3 alias here would understate how long the real paths are.
|
||||
# ProviderPath, not Path: on a UNC root the latter comes back in
|
||||
# provider-qualified form ("Microsoft.PowerShell.Core\FileSystem::\\srv\
|
||||
# share"), which no Win32 call can open - the scan then found nothing.
|
||||
$fullPath = $p
|
||||
try { $fullPath = (Resolve-Path -LiteralPath $p).Path } catch { }
|
||||
try {
|
||||
$rp = Resolve-Path -LiteralPath $p -ErrorAction Stop
|
||||
$cand = [string]$rp.ProviderPath
|
||||
if ([string]::IsNullOrWhiteSpace($cand)) { $cand = [string]$rp.Path }
|
||||
if ($cand) { $fullPath = $cand }
|
||||
} catch { }
|
||||
$fullPath = Expand-FilerShortPath -Path $fullPath
|
||||
$node = Get-FolderNode -Path $fullPath -MaxLen $MaxPathLength `
|
||||
-LongPaths $longPaths -ScanErrors $scanErrors -Progress $Progress
|
||||
|
||||
Reference in New Issue
Block a user