From 7c639fc1313877549fa08100113958458dadb922 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20=E2=80=9CNiols=E2=80=9D=20Jeannerod?= Date: Fri, 21 Feb 2025 15:13:38 +0100 Subject: [PATCH] Support empty strings in `removeTrailingWhitespace` --- keys/default.nix | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/keys/default.nix b/keys/default.nix index 9c1a2bd3..c51049cb 100644 --- a/keys/default.nix +++ b/keys/default.nix @@ -18,7 +18,12 @@ let maybeMatch = match "(.*)\.pub" s; in if maybeMatch == null then s else elemAt maybeMatch 0; - removeTrailingWhitespace = s: elemAt (match "(.*[^[:space:]])[[:space:]]*" s) 0; + removeTrailingWhitespace = + s: + let + maybeMatch = match "(.*[^[:space:]])[[:space:]]*" s; + in + if maybeMatch == null then "" else elemAt maybeMatch 0; collectKeys = dir: