pnp / PnP-PowerShell

SharePoint PnP PowerShell CmdLets
https://pnp.github.io/powershell
Other
985 stars 665 forks source link

Remove trailing '/' at the end of the url when calling Add-PnPStoredCredential #2925

Closed jackpoz closed 3 years ago

jackpoz commented 3 years ago

Type

Related Issues?

Fixes #2920

What is in this Pull Request ?

Remove trailing '/' at the end of the url when calling Add-PnPStoredCredential. I can't think of a case when it would be needed to keep the '/' character at the end of the url when stored in the credentials manager.

erwinvanhunen commented 3 years ago

Hi! Thank you for PR. Your change assumes that the entry added to the credential store is always an URL, but what if I would want to add 'MyLabel/' ? I know it's a trivial example, but technically we have supported this. Your change makes this entry being added as 'MyLabel'. This scenario would fail:


Add-PnPStoredCredential -Name 'MyLabel/' -UserName ... -Password ...
Get-PnPStoredCredential -Name 'MyLabel/'
erwinvanhunen commented 3 years ago

Adding to this: as @ToddKlindt mentions in the issue: we should fix this rather in the logic where we determine the credential manager entry to use.