Skip to content

Commit

Permalink
Savedocuments (#165)
Browse files Browse the repository at this point in the history
* 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 <[email protected]>
  • Loading branch information
dnewsholme and Daryl Newsholme authored Jun 14, 2024
1 parent 235d1f5 commit 9ab2dbc
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion functions/Save-PasswordStateDocument.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion internal/functions/Get-PasswordStateResource.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
2 changes: 1 addition & 1 deletion internal/functions/New-PasswordStateResource.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
2 changes: 1 addition & 1 deletion internal/functions/Remove-PasswordStateResource.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
2 changes: 1 addition & 1 deletion internal/functions/Set-PasswordStateResource.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit 9ab2dbc

Please sign in to comment.