Skip to content

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

Merged
Andrew (anmenaga) merged 2 commits into
PowerShell:masterfrom
SteveL-MSFT:getexactpath
Oct 31, 2019
Merged

Andrew (anmenaga) merged 2 commits into
PowerShell:masterfrom
SteveL-MSFT:getexactpath

Conversation

@SteveL-MSFT

@SteveL-MSFT Steve Lee (SteveL-MSFT) commented Oct 29, 2019 •

Copy link
Copy Markdown
Member

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

Ilya (iSazonov) commented Oct 29, 2019 •

Copy link
Copy Markdown
Collaborator

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

@anmenaga Andrew (anmenaga) left a comment

Copy link
Copy Markdown

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 Andrew (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 Andrew (anmenaga) added this to the 7.0.0-preview.6 milestone Oct 30, 2019
@anmenaga
Andrew (anmenaga) merged commit 2297627 into PowerShell:master Oct 31, 2019
@SteveL-MSFT
Steve Lee (SteveL-MSFT) deleted the getexactpath branch October 31, 2019 19:07
@ghost

Copy link
Copy Markdown

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

Handy links:

Thatgfsj (Thatgfsj) pushed a commit to Thatgfsj-contribs/PowerShell that referenced this pull request Aug 6, 2026
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