PasswordState icon indicating copy to clipboard operation
PasswordState copied to clipboard

Some special characters in Passwords will result in an error

Open Claustn opened this issue 9 years ago • 1 comments

Expected Behavior

If you use special chars like ¤$ in your password, Invoke-Webrequest will give you an error, this is because powershell uses UniCode wheres as the web request expects UTF8

Current Behavior

Possible Solution

$result = Invoke-RestMethod -Uri $uri -Method Post -ContentType "application/$Format" -Headers $headers -Body ([System.Text.Encoding]::UTF8.GetBytes($json))

Force the json to be loaded as UTF8.

Steps to Reproduce (for bugs)

  1. New-PasswordStatePassword -ApiKey $ADUserListCred -PasswordListId 49 -Username ctn -Password ('1dsdsdsdfsdsd¤234' | ConvertTo-SecureString -AsPlainText -Force) -ExpiryDate '15-10-2020 14:37:30' -Title test1234 -Verbose 2. 3. 4.

Context

I am adding some extra stuff, so will do a PR when I get that worked out.

Your Environment

  • Module version used:
  • Operating System and PowerShell version:

Claustn avatar Aug 04 '16 12:08 Claustn

Awesome. Thanks for finding this!

devblackops avatar Aug 05 '16 06:08 devblackops