Show file name in Invoke-WebRequest -OutFile -Verbose #24041
Merged
iSazonov merged 1 commit intoPowerShell:masterfrom Jul 17, 2024
Merged
Show file name in Invoke-WebRequest -OutFile -Verbose #24041iSazonov merged 1 commit intoPowerShell:masterfrom
iSazonov merged 1 commit intoPowerShell:masterfrom
Conversation
jborean93
reviewed
Jul 11, 2024
Collaborator
There was a problem hiding this comment.
Wouldn't we want to use the outFilePath rather than repeating the more complex logic done in GetOutFilePath? We can keep the Path.GetFileName call if we just want the filename and not the full path.
Collaborator
Author
There was a problem hiding this comment.
@jborean93 , good catch! That is a much better way to do it.
…e logic in GetOutFilePath method.
5bc92fa to
f3bb513
Compare
Collaborator
|
@mklement0 Please review. |
Contributor
Collaborator
Contributor
|
It does. |
iSazonov
approved these changes
Jul 17, 2024
Contributor
|
📣 Hey @jshigetomi, how did we do? We would love to hear your feedback with the link below! 🗣️ 🔗 https://aka.ms/PSRepoFeedback |
chrisdent-de
pushed a commit
to chrisdent-de/PowerShell
that referenced
this pull request
Sep 12, 2024
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
When using the Invoke-WebRequest -OutFile the verbose output of the file name is not the file name but the provided directory. File name should reflect the downloaded file name and not the directory.
I replaced the directory output to the file name I accessed from the HttpResponseMessage object.
PR Context
Fixes: #21081
This PR is part of an effort to resolve all issues related to @CarloToso 's contribution which made directory passing available for Invoke-WebRequest cmdlet when the -OutFile flag is present.
@mklement0 mentioned in #21081 that
VERBOSE: File Name:displays the given directory name instead of the file name.PR Checklist
.h,.cpp,.cs,.ps1and.psm1files have the correct copyright headerWIP:or[ WIP ]to the beginning of the title (theWIPbot will keep its status check atPendingwhile the prefix is present) and remove the prefix when the PR is ready.- [ ] Issue filed:
(which runs in a different PS Host).