Skip to content

Fix #2628: Should -Exist uses -LiteralPath for paths with wildcard characters#2691

Merged
nohwnd merged 1 commit intopester:mainfrom
nohwnd:fix-2628-literalpath
Apr 4, 2026
Merged

Fix #2628: Should -Exist uses -LiteralPath for paths with wildcard characters#2691
nohwnd merged 1 commit intopester:mainfrom
nohwnd:fix-2628-literalpath

Conversation

@nohwnd
Copy link
Copy Markdown
Member

@nohwnd nohwnd commented Apr 3, 2026

Fix #2628

Changed Test-Path to Test-Path -LiteralPath so paths with literal bracket characters [ ] are found correctly.

Copilot-generated fix.

Co-authored-by: Copilot 223556219+Copilot@users.noreply.github.com

@nohwnd
Copy link
Copy Markdown
Member Author

nohwnd commented Apr 3, 2026

as commented this should keep the original semantics , and add literal path parameter and test that

@nohwnd
Copy link
Copy Markdown
Member Author

nohwnd commented Apr 3, 2026

🤖 Got it — will keep original Test-Path semantics and add a new -LiteralPath parameter with tests for both paths.

Keep default wildcard behavior (Test-Path) and add optional -LiteralPath
switch that uses Test-Path -LiteralPath for paths with special characters.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@nohwnd nohwnd force-pushed the fix-2628-literalpath branch from e302ab5 to 8c1e8cb Compare April 3, 2026 13:59
@nohwnd nohwnd marked this pull request as ready for review April 4, 2026 11:04
@nohwnd nohwnd merged commit 1ed2167 into pester:main Apr 4, 2026
13 checks passed
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

Successfully merging this pull request may close these issues.

The -Exist parameter of Should cannot find the file if the file name contains a wildcard character

1 participant