-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Show file name in Invoke-WebRequest -OutFile -Verbose #24041
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jborean93 , good catch! That is a much better way to do it.
…e logic in GetOutFilePath method.
5bc92fa to
f3bb513
Compare
|
@mklement0 Please review. |
|
It does. |
|
📣 Hey @jshigetomi, how did we do? We would love to hear your feedback with the link below! 🗣️ 🔗 https://aka.ms/PSRepoFeedback |
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).