-
Notifications
You must be signed in to change notification settings - Fork 6
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
Fixes for saving files in correct name and format based on type. #104
base: main
Are you sure you want to change the base?
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.
Thanks so much for the PR! Just need one change.
Thank you for the feedback. I had considered putting the Type information
somewhere else, but the ConvertFrom-TNRestResponse.ps1 is where this data
is stripped off the object. No matter what I've done, after data has been
piped through this it's gone forever. I'm not sure why it gets stripped
off when it's clearly there, but the output of this is always missing the
'type' property. I'll keep trying.
Thanks!
…On Tue, Nov 30, 2021 at 3:09 PM Chrissy LeMaire ***@***.***> wrote:
***@***.**** requested changes on this pull request.
Thanks so much for the PR! Just need one change.
------------------------------
In public/ConvertFrom-TNRestResponse.ps1
<#104 (comment)>
:
> @@ -156,7 +156,7 @@
if ('Id' -in $keys) {
$null = $order.Add("Id")
}
- if ($Type) {
+ if ('Type') {
This will always return $true. You can test it from your command line
if ('Type') { write-warning hello }
WARNING: hello
Instead, change it back to $Type and perhaps pass a -Type elsewhere,
likely in Save-TNReportResult.
------------------------------
In public/Save-TNReportResult.ps1
<#104 (comment)>
:
> @@ -44,7 +44,7 @@ function Save-TNReportResult {
Stop-PSFFunction -EnableException:$EnableException -Message "Only tenable.sc supported" -Continue
}
foreach ($file in $InputObject) {
- $filename = Join-Path -Path $Path -ChildPath "$($file.Name.Split([IO.Path]::GetInvalidFileNameChars()) -join '')-$($file.Id)-reportresults.zip"
+ $filename = Join-Path -Path $Path -ChildPath "$($file.Name.Split([IO.Path]::GetInvalidFileNameChars()) -join '')-$($file.Id)-reportresults.$($file.Type)"
Perfect!
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#104 (review)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABHYPPDPU6D3GZJZK74I3HTUOTSLTANCNFSM5JCANWPA>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
|
I'm not sure if email is the right way to go about this, but I tried the
following:
if ('Type' -in $keys) {
$null = $order.Add("Type")
This works and saves the files correctly and it seems as it would work
with not always being $true, unless I'm really offbase.
…On Tue, Nov 30, 2021 at 3:41 PM Chris Bensch ***@***.***> wrote:
Thank you for the feedback. I had considered putting the Type information
somewhere else, but the ConvertFrom-TNRestResponse.ps1 is where this data
is stripped off the object. No matter what I've done, after data has been
piped through this it's gone forever. I'm not sure why it gets stripped
off when it's clearly there, but the output of this is always missing the
'type' property. I'll keep trying.
Thanks!
On Tue, Nov 30, 2021 at 3:09 PM Chrissy LeMaire ***@***.***>
wrote:
> ***@***.**** requested changes on this pull request.
>
> Thanks so much for the PR! Just need one change.
> ------------------------------
>
> In public/ConvertFrom-TNRestResponse.ps1
> <#104 (comment)>
> :
>
> > @@ -156,7 +156,7 @@
> if ('Id' -in $keys) {
> $null = $order.Add("Id")
> }
> - if ($Type) {
> + if ('Type') {
>
> This will always return $true. You can test it from your command line
>
> if ('Type') { write-warning hello }
> WARNING: hello
>
> Instead, change it back to $Type and perhaps pass a -Type elsewhere,
> likely in Save-TNReportResult.
> ------------------------------
>
> In public/Save-TNReportResult.ps1
> <#104 (comment)>
> :
>
> > @@ -44,7 +44,7 @@ function Save-TNReportResult {
> Stop-PSFFunction -EnableException:$EnableException -Message "Only tenable.sc supported" -Continue
> }
> foreach ($file in $InputObject) {
> - $filename = Join-Path -Path $Path -ChildPath "$($file.Name.Split([IO.Path]::GetInvalidFileNameChars()) -join '')-$($file.Id)-reportresults.zip"
> + $filename = Join-Path -Path $Path -ChildPath "$($file.Name.Split([IO.Path]::GetInvalidFileNameChars()) -join '')-$($file.Id)-reportresults.$($file.Type)"
>
> Perfect!
>
> —
> You are receiving this because you authored the thread.
> Reply to this email directly, view it on GitHub
> <#104 (review)>,
> or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/ABHYPPDPU6D3GZJZK74I3HTUOTSLTANCNFSM5JCANWPA>
> .
> Triage notifications on the go with GitHub Mobile for iOS
> <https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
> or Android
> <https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
>
>
|
I think I was able to solve the $true issue, but I will need you to validate it works as expected. |
hey chris, sorry for the delay. my shoulder is all messed up, so i'll likely be able to take a look on Monday, i'll be in touch then! |
this looks great! does it work for you? (the tests dont work bc of a limitation with my repo secrets) |
Yes, these work for me. I tested them officially today and it's good to go!
…On Tue, Dec 7, 2021 at 3:22 PM Chrissy LeMaire ***@***.***> wrote:
this looks great! does it work for you? (the tests dont work bc of a
limitation with my repo secrets)
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#104 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABHYPPEIV72QDW6UZHOHOSTUPYRERANCNFSM5JCANWPA>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
|
No description provided.