Skip to content

Improve output file path determination for Invoke-WebRequest - #27872

Merged
Travis Plunk (TravisEz13) merged 1 commit into
PowerShell:masterfrom
anamnavi:iwr-validation
Aug 20, 2026
Merged

Travis Plunk (TravisEz13) merged 1 commit into
PowerShell:masterfrom
anamnavi:iwr-validation

Conversation

@anamnavi

@anamnavi Anam Navied (anamnavi) commented Aug 20, 2026

Copy link
Copy Markdown
Member

PR Summary

This pull request refines output file path determination for Invoke-WebRequest when -OutFile references a directory.

The implementation now extracts the file name from the final URI segment before combining it with the destination directory, resulting in more consistent output file path generation.

PR Context

PR Checklist

@anamnavi
Anam Navied (anamnavi) requested a review from a team as a code owner August 20, 2026 17:58
Copilot AI lite review requested due to automatic review settings August 20, 2026 17:58
@azure-pipelines

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

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.

Pull request overview

This pull request updates how Invoke-WebRequest/web cmdlets derive an output file path when -OutFile points to a directory, by ensuring only a file name (not a decoded path) from the last URI segment is appended.

Changes:

  • Update WebResponseHelper.GetOutFilePath to wrap the decoded last URI segment with Path.GetFileName before joining with the output directory.

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

@anamnavi Anam Navied (anamnavi) added the CL-General Indicates that a PR should be marked as a general cmdlet change in the Change Log label Aug 20, 2026
@TravisEz13
Travis Plunk (TravisEz13) merged commit 2fab4a6 into PowerShell:master Aug 20, 2026
36 of 42 checks passed
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.

4 participants