fix: handle OSError when age keys are too long to be file paths
Prevents "File name too long" errors when users provide age keys directly to 'clan secrets users add', as Path.is_file() would fail before the key validation could run. Fixes: https://git.clan.lol/clan/clan-core/issues/5522
This commit is contained in:
@@ -22,7 +22,13 @@ def secret_name_type(arg_value: str) -> str:
|
||||
|
||||
|
||||
def public_or_private_age_key_type(arg_value: str) -> str:
|
||||
if Path(arg_value).is_file():
|
||||
try:
|
||||
is_file = Path(arg_value).is_file()
|
||||
except OSError:
|
||||
# Handle "File name too long" errors when age keys are passed directly
|
||||
is_file = False
|
||||
|
||||
if is_file:
|
||||
arg_value = Path(arg_value).read_text().strip()
|
||||
elif arg_value.startswith("AGE-PLUGIN-"):
|
||||
msg = (
|
||||
|
||||
Reference in New Issue
Block a user