Fix New-Item -Path with wildcard char#7404
Closed
kwkam wants to merge 3 commits intoPowerShell:masterfrom
Closed
Conversation
Unescape non-literal path when -Name is not set. This works around for New-Item treating -Path as literal path while it can also be globbable. For example, assuming there is "[file]1" in current directory, and tab completion suggests './`[file`]1' for the -Path argument, but > New-Item -Path './`[file`]2' will create a file named "`[file`]2" instead of "[file]2".
11 tasks
Contributor
Author
|
Test result depends on WildcardPattern::Escape in #7407 |
kwkam
added a commit
to kwkam/PowerShell
that referenced
this pull request
Aug 12, 2018
kvprasoon
suggested changes
Aug 27, 2018
test/powershell/Modules/Microsoft.PowerShell.Management/New-Item.Tests.ps1
Outdated
Show resolved
Hide resolved
test/powershell/Modules/Microsoft.PowerShell.Management/New-Item.Tests.ps1
Outdated
Show resolved
Hide resolved
| Describe "Remove-Item" -Tags "CI" { | ||
| $testpath = $TestDrive | ||
| $testfile = "testfile.txt" | ||
| $testfileSpName = "[testfile].txt" |
Contributor
There was a problem hiding this comment.
Align variable definitions.
$testpath = $TestDrive
$testfile = "testfile.txt"
$testfile = "testfile.txt"
$testfileSpName = "[testfile].txt"
$testfileSp = "``[testfile``].txt"
$testfilepath = Join-Path -Path $testpath -ChildPath $testfile
$testfilepath = Join-Path -Path $testpath -ChildPath $testfile
$testfilepathSp = Join-Path -Path $testpath -ChildPath $testfileSp
|
This PR has been automatically marked as stale because it has not had activity in the last 30 days. It will be closed if no further activity occurs within 10 days. |
|
This PR has be automatically close because it is stale. If you wish to continue working on the PR, please first update the PR, then reopen it. |
10 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Summary
Unescape non-literal path when -Name is not set.
This works around for New-Item treating -Path as literal path while
it can also be globbable. For example, assuming there is
"[file]1"in current directory, and tab completion suggests
'./`[file`]1'for the -Path argument, but
will create a file named
"`[file`]2"instead of"[file]2".PR Checklist
.h,.cpp,.cs,.ps1and.psm1files have the correct copyright headerWIP:to the beginning of the title and remove the prefix when the PR is ready.[feature]if the change is significant or affects feature tests