Skip to content

Fix GetCorrectCasedPath() to first check if any system file entries is returned before calling First()#10930

Merged
anmenaga merged 2 commits intoPowerShell:masterfrom
SteveL-MSFT:getexactpath
Oct 31, 2019
Merged

Fix GetCorrectCasedPath() to first check if any system file entries is returned before calling First()#10930
anmenaga merged 2 commits intoPowerShell:masterfrom
SteveL-MSFT:getexactpath

Conversation

@SteveL-MSFT
Copy link
Copy Markdown
Member

@SteveL-MSFT SteveL-MSFT commented Oct 29, 2019

PR Summary

On WSL, if you have a folder in /mnt/c/Users/steve/Blah and try: test-path /mnt/c/Users/steve/blah -pathtype container you get an error because .First() is being called on an empty string array. Fix is to check that the returned array contains something. Otherwise, just return the given path as some file system issue prevents correcting the casing. This issue seems to only repro on WSL (Windows Subsystem on Linux)

PR Checklist

@iSazonov
Copy link
Copy Markdown
Collaborator

iSazonov commented Oct 29, 2019

I can not repo on WSL1. Is the issue on WSL2?

Copy link
Copy Markdown

@anmenaga anmenaga left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WSL== Windows Subsystem for Linux ? it would be good to mention this in PR description.

@anmenaga anmenaga added the CL-General Indicates that a PR should be marked as a general cmdlet change in the Change Log label Oct 30, 2019
@anmenaga anmenaga added this to the 7.0.0-preview.6 milestone Oct 30, 2019
@anmenaga anmenaga merged commit 2297627 into PowerShell:master Oct 31, 2019
@SteveL-MSFT SteveL-MSFT deleted the getexactpath branch October 31, 2019 19:07
@ghost
Copy link
Copy Markdown

ghost commented Nov 21, 2019

🎉v7.0.0-preview.6 has been released which incorporates this pull request.:tada:

Handy links:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CL-General Indicates that a PR should be marked as a general cmdlet change in the Change Log

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants