diff options
author | Joey Hess <joey@kitenet.net> | 2012-10-16 01:43:54 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2012-10-16 01:43:54 -0400 |
commit | fdc887a7c076883c71b5f3f608eb2b458eabbe16 (patch) | |
tree | 692e0acbbc42e4df126d8b206e30b25d919e4015 | |
parent | 4d1a950d39ae0d7c7ef7bdacd8c903807614d199 (diff) |
avoid partial !! in gpg list-keys parser
-rw-r--r-- | Utility/Gpg.hs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/Utility/Gpg.hs b/Utility/Gpg.hs index 8d25272d3..b5cffb1c5 100644 --- a/Utility/Gpg.hs +++ b/Utility/Gpg.hs @@ -87,9 +87,9 @@ findPubKeys :: String -> IO KeyIds findPubKeys for = KeyIds . parse <$> readStrict params where params = [Params "--with-colons --list-public-keys", Param for] - parse = map keyIdField . filter pubKey . lines - pubKey = isPrefixOf "pub:" - keyIdField s = split ":" s !! 4 + parse = catMaybes . map (keyIdField . split ":") . lines + keyIdField ("pub":_:_:_:f:_) = Just f + keyIdField _ = Nothing {- Creates a block of high-quality random data suitable to use as a cipher. - It is armored, to avoid newlines, since gpg only reads ciphers up to the |