Title: `Invoke-WebRequest -PassThru`, when combined with `-OutFile`, should reflect the download file path. · Issue #21082 · PowerShell/PowerShell · GitHub
Open Graph Title: `Invoke-WebRequest -PassThru`, when combined with `-OutFile`, should reflect the download file path. · Issue #21082 · PowerShell/PowerShell
X Title: `Invoke-WebRequest -PassThru`, when combined with `-OutFile`, should reflect the download file path. · Issue #21082 · PowerShell/PowerShell
Description: Summary of the new feature / enhancement Thanks to a contribution by @CarloToso, since v7.4.0 it has been possible to pass a directory rather than a file path to -OutFile, in which the web cmdlets use the (ultimate) target URL's last seg...
Open Graph Description: Summary of the new feature / enhancement Thanks to a contribution by @CarloToso, since v7.4.0 it has been possible to pass a directory rather than a file path to -OutFile, in which the web cmdlets ...
X Description: Summary of the new feature / enhancement Thanks to a contribution by @CarloToso, since v7.4.0 it has been possible to pass a directory rather than a file path to -OutFile, in which the web cmdlets ...
Opengraph URL: https://github.com/PowerShell/PowerShell/issues/21082
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"`Invoke-WebRequest -PassThru`, when combined with `-OutFile`, should reflect the download file path.","articleBody":"### Summary of the new feature / enhancement\n\nThanks to a contribution by @CarloToso, since v7.4.0 it has been possible to pass a _directory_ rather than a file path to `-OutFile`, in which the web cmdlets use the (ultimate) target URL's _last segment_ as the file name.\r\n\r\nGiven that, when redirections are involved, you won't know what that last segment is, being able to _programmatically_ discover the resulting full download file path is important.\r\n\r\nThis will also apply to the planned support for using a _server-suggested_ output file name via a `Content-Disposition` response header field - see PR https://github.com/PowerShell/PowerShell/pull/19385\r\n\r\n(Using `-Verbose` is a way to discover the file name _interactively_; while it's technically possible to programmatically parse the verbose output, that would be both cumbersome and brittle).\r\n\r\nThus - at least when `-OutFile` is used - the `[Microsoft.PowerShell.Commands.WebResponseObject]` instance returned via `-PassThru` should have an `.OutFile` property or similar that reflects the output file's full path.\r\n\r\nRelated:\r\n\r\n * #21081\n\n### Proposed technical implementation details (optional)\n\nI don't know whether it's worth extending `[Microsoft.PowerShell.Commands.WebResponseObject]` or not.\r\n\r\nIf not, an ETS `NoteProperty` member could be used.\r\n\r\n","author":{"url":"https://github.com/mklement0","@type":"Person","name":"mklement0"},"datePublished":"2024-01-16T19:57:31.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":2},"url":"https://github.com/21082/PowerShell/issues/21082"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:ba33a423-0310-0276-d45b-55fc8ffb1f95 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8274:45FC:95692D:C87D4D:6A599227 |
| html-safe-nonce | c30a181428de16e21b675018ec5ac54e66ff5cc515e84a66f8277f2cce1cec70 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4Mjc0OjQ1RkM6OTU2OTJEOkM4N0Q0RDo2QTU5OTIyNyIsInZpc2l0b3JfaWQiOiI0MzAxMTI4NzAzMjQ4MjczOTU5IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 66ff8f22acef03929d4bc0cd90e7dbac069e9696c09835c7a34eb004ca8f0fa9 |
| hovercard-subject-tag | issue:2084753971 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/PowerShell/PowerShell/21082/issue_layout |
| twitter:image | https://opengraph.githubassets.com/b4bb2452b6754ac7bb7ca75a0156334a4dd55fadffbd7acdc49f005565cdbc78/PowerShell/PowerShell/issues/21082 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/b4bb2452b6754ac7bb7ca75a0156334a4dd55fadffbd7acdc49f005565cdbc78/PowerShell/PowerShell/issues/21082 |
| og:image:alt | Summary of the new feature / enhancement Thanks to a contribution by @CarloToso, since v7.4.0 it has been possible to pass a directory rather than a file path to -OutFile, in which the web cmdlets ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | mklement0 |
| hostname | github.com |
| expected-hostname | github.com |
| None | a540949572872b935b393b36db38922db390ae71c859537d741b8f3eb7e545b5 |
| turbo-cache-control | no-preview |
| go-import | github.com/PowerShell/PowerShell git https://github.com/PowerShell/PowerShell.git |
| octolytics-dimension-user_id | 11524380 |
| octolytics-dimension-user_login | PowerShell |
| octolytics-dimension-repository_id | 49609581 |
| octolytics-dimension-repository_nwo | PowerShell/PowerShell |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 49609581 |
| octolytics-dimension-repository_network_root_nwo | PowerShell/PowerShell |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 624bb50a7497aa346bef8cc3743af408a9ea10ca |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width