Visitar URL original
Fix `Resolve-Path -Relative` output for dot-prefixed names by daxian-dbw · Pull Request #28087 · PowerShell/PowerShell · GitHub
Skip to content

Fix Resolve-Path -Relative output for dot-prefixed names - #28087

Open
Dongbo Wang (daxian-dbw) wants to merge 4 commits into
PowerShell:masterfrom
daxian-dbw:rvpa-relative-dot
Open

Dongbo Wang (daxian-dbw) wants to merge 4 commits into
PowerShell:masterfrom
daxian-dbw:rvpa-relative-dot

Conversation

@daxian-dbw

@daxian-dbw Dongbo Wang (daxian-dbw) commented Sep 24, 2026 •

Copy link
Copy Markdown
Member

Summary

Fix Resolve-Path -Relative output for dot-prefixed names.

  • Distinguish explicit dot-relative segments from path names that begin with a dot
  • Prepend the current-directory marker for dot-prefixed relative paths
  • Add cross-platform regression coverage

Before the fix

PS:138> dir .abc, delme | Resolve-Path -Relative
.abc\abc.md
.\delme\delme.md
.\delme\loc.ps1
.\delme\locItems.txt

After the fix

PS Q:\yard> dir .abc, delme | Resolve-Path -Relative
.\.abc\abc.md
.\delme\delme.md
.\delme\loc.ps1
.\delme\locItems.txt

PR Checklist

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI lite review requested due to automatic review settings September 24, 2026 05:19
@daxian-dbw
Dongbo Wang (daxian-dbw) requested a review from a team as a code owner September 24, 2026 05:19
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

@daxian-dbw Dongbo Wang (daxian-dbw) changed the title Fix Resolve-Path output for dot-prefixed names Fix Resolve-Path -Relative output for dot-prefixed names Sep 24, 2026
@daxian-dbw Dongbo Wang (daxian-dbw) added the CL-General Indicates that a PR should be marked as a general cmdlet change in the Change Log label Sep 24, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🔵 Needs a closer look

Add coverage ensuring names such as ..directory are not treated as explicit .. segments.

Review effort: Lite
Findings: None

What changed in this PR

Fixes Resolve-Path -Relative handling for dot-prefixed names and adds cross-platform regression coverage.

Changes:

  • Adds provider-aware relative-token detection.
  • Corrects ./ insertion logic.
  • Adds regression coverage for dot-prefixed paths.
File Summary
test/​powershell/​Modules/​Microsoft.PowerShell.Management/​Resolve-Path.Tests.ps1 Adds regression coverage; still needs a ..directory boundary case.
src/​Microsoft.PowerShell.Commands.Management/​commands/​management/​ResolvePathCommand.cs Corrects relative path prefix handling.

💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

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

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🔵 Needs a closer look

Preserve the relative prefix for subsequent results from the same directory and add multi-result regression coverage.

Review effort: Lite
Findings: None

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

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🟢 Approval recommended

Only a minor test-coverage nit remains; no blocking issues were identified.

Review effort: Lite
Findings: None

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
}

It "Resolve-Path -Relative prepends the current directory to every result" {
$directoryNames = ".directory", "..directory", "directory"

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

If we support "." and "..", then it's worth adding them to the tests.

@microsoft-github-policy-service microsoft-github-policy-service Bot added the Review - Needed The PR is being reviewed label Oct 6, 2026
@microsoft-github-policy-service

Copy link
Copy Markdown
Contributor

This pull request has been automatically marked as Review Needed because it has been there has not been any activity for 7 days.
Maintainer, please provide feedback and/or mark it as Waiting on Author

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 Review - Needed The PR is being reviewed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants