snazy2000/SnipeitPS

New-SnipeitLicense fails when license_email parameter provided

cavesnail opened this issue · 0 comments

Context

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

Your Environment

  • SnipeitPS Module version used: 1.10.227
  • Operating System and PowerShell version: Win10 Pro 10.0.19045, PS 7.2.11

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.