Title: Get-Content, Set-Content, and Clear-Content should work with datastreams set on directories · Issue #13656 · PowerShell/PowerShell · GitHub
Open Graph Title: Get-Content, Set-Content, and Clear-Content should work with datastreams set on directories · Issue #13656 · PowerShell/PowerShell
X Title: Get-Content, Set-Content, and Clear-Content should work with datastreams set on directories · Issue #13656 · PowerShell/PowerShell
Description: Summary of the new feature/enhancement Set-Content, Clear-Content, and Get-Content should, but currently do not, work on datastreams set on directories. Bug #10570 requested that Get-Item name -Stream streamname should work the same way ...
Open Graph Description: Summary of the new feature/enhancement Set-Content, Clear-Content, and Get-Content should, but currently do not, work on datastreams set on directories. Bug #10570 requested that Get-Item name -Str...
X Description: Summary of the new feature/enhancement Set-Content, Clear-Content, and Get-Content should, but currently do not, work on datastreams set on directories. Bug #10570 requested that Get-Item name -Str...
Opengraph URL: https://github.com/PowerShell/PowerShell/issues/13656
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Get-Content, Set-Content, and Clear-Content should work with datastreams set on directories","articleBody":"## Summary of the new feature/enhancement\r\n\r\nSet-Content, Clear-Content, and Get-Content should, but currently do not, work on datastreams set on directories.\r\n\r\nBug #10570 requested that `Get-Item name -Stream streamname` should work the same way for directories that it does for files. Previously, there existed a check that bypassed any datastreams being looked for on directories, but NTFS supports it. PR #13650 allows for this operation.\r\n\r\nDuring the process of writing the tests for #13650, I found that Set-Content would not set a stream on a directory (because Clear-Content does not work on directories). As such, I had to call out to cmd.exe to do so, but the interaction between PowerShell and cmd led to the string it was set to to be followed by two newlines, and I had to change the size test accordingly.\r\n\r\nIf it's possible to read datastreams on directories, it should be possible to write them.\r\n\r\n## Proposed technical implementation details (optional)\r\n\r\nGet-Content for datastreams on directories should not return an error that the user should use Get-ChildItem instead.\r\nSet-Content for datastreams on directories should behave the same way that it does for datastreams on files. Because Set-Content calls Clear-Content, Clear-Content needs to be changed to look for a -Stream parameter and bypass the directory check if that parameter is provided. Set-Content may also have additional directory checks which would need to be bypassed if a -Stream parameter were provided, but I have not investigated that far.\r\n\r\n","author":{"url":"https://github.com/kyanha","@type":"Person","name":"kyanha"},"datePublished":"2020-09-18T18:58:09.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/13656/PowerShell/issues/13656"}
| 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:20c09af0-ced4-548b-f5a6-3203712d3a62 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | AFF4:2D5E27:1732C2B:1FA347A:6A5236ED |
| html-safe-nonce | 82ab318be3044eeff7acec6591303e39a9c9c92d7eac39c0fa55da69b5a95c66 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBRkY0OjJENUUyNzoxNzMyQzJCOjFGQTM0N0E6NkE1MjM2RUQiLCJ2aXNpdG9yX2lkIjoiMjcyNzM3MzM0OTM1NzUwMDE0MSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 4fdc38fd3c5a4bac6cdc4d908d6703eea12cebccd611523bd4f1af99dcde158a |
| hovercard-subject-tag | issue:704588725 |
| 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/13656/issue_layout |
| twitter:image | https://opengraph.githubassets.com/538f4f83a4e80e4c5a86d518ccfa0a39ed098d874cae3211e5d30f66aa92c596/PowerShell/PowerShell/issues/13656 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/538f4f83a4e80e4c5a86d518ccfa0a39ed098d874cae3211e5d30f66aa92c596/PowerShell/PowerShell/issues/13656 |
| og:image:alt | Summary of the new feature/enhancement Set-Content, Clear-Content, and Get-Content should, but currently do not, work on datastreams set on directories. Bug #10570 requested that Get-Item name -Str... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | kyanha |
| hostname | github.com |
| expected-hostname | github.com |
| None | b9a586c06a05a7a86fc7e3f4dbd03e42f6869085879aa184aa6369456dbd50fb |
| 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 | 7aed05249554b889eb33d002851a973eebcc7e91 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width