mirror of
https://github.com/rbalsleyMSFT/FFU.git
synced 2026-06-14 02:09:35 -06:00
Add robust sanitization for names used in paths
Introduces a new common function, `ConvertTo-SafeName`, to sanitize strings by removing characters that are invalid in Windows file paths. This function is now used consistently when creating directory and file names for drivers (Dell, HP, Lenovo, Microsoft) and applications to prevent path-related errors. It replaces several ad-hoc sanitization methods with a single, more robust implementation.
This commit is contained in:
@@ -106,7 +106,8 @@ function Save-LenovoDriversTask {
|
||||
$identifier = $DriverItemData.Model
|
||||
$machineType = $DriverItemData.MachineType
|
||||
$make = "Lenovo"
|
||||
$sanitizedIdentifier = $identifier -replace '[\\/:"*?<>|]', '_'
|
||||
$sanitizedIdentifier = ConvertTo-SafeName -Name $identifier
|
||||
if ($sanitizedIdentifier -ne $identifier) { WriteLog "Sanitized model identifier: '$identifier' -> '$sanitizedIdentifier'" }
|
||||
$status = "Starting..."
|
||||
$success = $false
|
||||
|
||||
|
||||
Reference in New Issue
Block a user