Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure all paths have been fully expanded before operating on them #137

Open
HowardWolosky opened this issue Sep 30, 2018 · 0 comments
Open

Comments

@HowardWolosky
Copy link
Member

HowardWolosky commented Sep 30, 2018

Shortened paths (like c:\program~1 for c:\program files) don't get expanded by Resolve-Path. This normally wouldn't be a problem except for instances of logic where we retrieve a list of files under that path, and then attempt to parse out that root path (example: in PackageTool, when we do this:

$split = $xmlFilePath -split $PDPRootPath, 0, "SimpleMatch | Where-Object { -not [String]::IsNullOrWhiteSpace($_) } | Select-Object -First 1
$language = $split -split "\", 0, "SimpleMatch" | Where-Object { -not [String]::IsNullOrWhiteSpace($_) } | Select-Object -First 1

In a scenario like that, the full name of the file will be expanded and not the shortened version, thus the initial part won't be correctly lobbed off.

We need to do something like this:

$inputPath = (Get-Item -Path $inputPath).FullName

for any $inputPath that we get from the user where a scenario like this might be possible. That will ensure that the path is expanded before we operate on it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant