Fix _validate_key to handle click 8.3.1 Sentinel values

Fixes #5836

Updates the condition in _validate_key to properly check for click._utils.UNSET sentinel value, which is now present in ctx.params during callbacks in click 8.3.1.
This commit is contained in:
pramod5403 2025-11-10 21:46:07 +05:30 committed by GitHub
parent 88a65bb374
commit ec942ef2f3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -858,8 +858,7 @@ def _validate_key(ctx: click.Context, param: click.Parameter, value: t.Any) -> t
ctx.params["cert"] = cert, value
else:
if cert and not (is_adhoc or is_context):
raise click.BadParameter('Required when using "--cert".', ctx, param)
if cert is not None and cert != click._utils.UNSET and not (is_adhoc or is_context): raise click.BadParameter('Required when using "--cert".', ctx, param)
return value