snazy2000 / SnipeitPS

Powershell API Wrapper for Snipe-it
MIT License
181 stars 47 forks source link

New-SnipeitLicense fails when license_email parameter provided #299

Open cavesnail opened 1 year ago

cavesnail commented 1 year ago

Context

When trying to use New-SnipeitLicense, it fails if a license_email parameter is provided.

Your Environment

Expected Behavior

Should take a string email address input and successfully create a license with it.

Current Behavior

Fails with an error that ValidateLength can not be applied on a non-string.

Possible Solution

The function appears to cast the license_email parameter to a mailaddress, which causes ValidateLength to fail, as ValidateLength only works on strings. Removing the validation, or casting to a string instead of a mailaddress, both worked on my end.

Steps to Reproduce (for bugs)

Run New-SnipeitLicense with dummy parameters, and pass a license_email parameter as well.