From 9ab2dbca83ff62cf4edc4e24711ffb7c119c07be Mon Sep 17 00:00:00 2001 From: Daryl Newsholme Date: Fri, 14 Jun 2024 10:32:35 +0100 Subject: [PATCH] Savedocuments (#165) * fix bug with passing non-header extra params. Also remove extra ID from url in save-document * fix bug with passing non-header extra params. Also remove extra ID from url in save-document --------- Co-authored-by: Daryl Newsholme --- functions/Save-PasswordStateDocument.ps1 | 2 +- internal/functions/Get-PasswordStateResource.ps1 | 2 +- internal/functions/New-PasswordStateResource.ps1 | 2 +- internal/functions/Remove-PasswordStateResource.ps1 | 2 +- internal/functions/Set-PasswordStateResource.ps1 | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/functions/Save-PasswordStateDocument.ps1 b/functions/Save-PasswordStateDocument.ps1 index 2f2df84..942833e 100644 --- a/functions/Save-PasswordStateDocument.ps1 +++ b/functions/Save-PasswordStateDocument.ps1 @@ -17,7 +17,7 @@ process { try { $output += Get-PasswordStateResource ` - -uri "/api/document/$($resourcetype)/$($ID)/$documentID" ` + -uri "/api/document/$($resourcetype)/$documentID" ` -extraparams @{"OutFile" = "$Path"} ` -contenttype 'multipart/form-data' ` -ErrorAction stop diff --git a/internal/functions/Get-PasswordStateResource.ps1 b/internal/functions/Get-PasswordStateResource.ps1 index 1ce9b5f..e0034e7 100644 --- a/internal/functions/Get-PasswordStateResource.ps1 +++ b/internal/functions/Get-PasswordStateResource.ps1 @@ -69,7 +69,7 @@ function Get-PasswordStateResource { $params += @{"headers" = $headers } $skipheaders = $true } - if ($extraparams -and $null -ne $extraparams.Headers -and $skipheaders -ne $true) { + if ($extraparams -and $null -ne $extraparams -and $skipheaders -ne $true) { Write-Verbose "[$(Get-Date -format G)] Adding extra parameter $($extraparams.keys) $($extraparams.values)" $params += $extraparams } diff --git a/internal/functions/New-PasswordStateResource.ps1 b/internal/functions/New-PasswordStateResource.ps1 index b81d2b0..0fcb968 100644 --- a/internal/functions/New-PasswordStateResource.ps1 +++ b/internal/functions/New-PasswordStateResource.ps1 @@ -71,7 +71,7 @@ function New-PasswordStateResource { $params += @{"headers" = $headers } $skipheaders = $true } - if ($extraparams -and $null -eq $extraparams.Headers) { + if ($extraparams -and $null -ne $extraparams) { Write-PSFMessage -Level Verbose -Message "Adding extra parameter $($extraparams.keys) $($extraparams.values)" $params += $extraparams } diff --git a/internal/functions/Remove-PasswordStateResource.ps1 b/internal/functions/Remove-PasswordStateResource.ps1 index d551a4d..6e4b45d 100644 --- a/internal/functions/Remove-PasswordStateResource.ps1 +++ b/internal/functions/Remove-PasswordStateResource.ps1 @@ -69,7 +69,7 @@ function Remove-PasswordStateResource { $params += @{"headers" = $headers } $skipheaders = $true } - if ($extraparams -and $null -eq $extraparams.Headers -and $skipheaders -ne $true) { + if ($extraparams -and $null -ne $extraparams -and $skipheaders -ne $true) { Write-Verbose "[$(Get-Date -format G)] Adding extra parameter $($extraparams.keys) $($extraparams.values)" $params += $extraparams } diff --git a/internal/functions/Set-PasswordStateResource.ps1 b/internal/functions/Set-PasswordStateResource.ps1 index 80784ab..81938b3 100644 --- a/internal/functions/Set-PasswordStateResource.ps1 +++ b/internal/functions/Set-PasswordStateResource.ps1 @@ -67,7 +67,7 @@ function Set-PasswordStateResource { $params += @{"headers" = $headers } $skipheaders = $true } - if ($extraparams -and $null -eq $extraparams.Headers -and $skipheaders -ne $true) { + if ($extraparams -and $null -ne $extraparams -and $skipheaders -ne $true) { Write-Verbose "[$(Get-Date -format G)] Adding extra parameter $($extraparams.keys) $($extraparams.values)" $params += $extraparams }