tighten file2key to not produce invalid keys with no keyName
A file named "foo-" or "foo-bar" was taken as a key's file, with a backend of "foo", and an empty keyName. This led to various problems, especially because converting that key back to a file did not yeild the same filename.
This commit is contained in:
parent
15597e5fff
commit
396e47b07e
4 changed files with 21 additions and 3 deletions
|
@ -346,7 +346,9 @@ fileKey file = file2key $
|
|||
|
||||
{- for quickcheck -}
|
||||
prop_idempotent_fileKey :: String -> Bool
|
||||
prop_idempotent_fileKey s = Just k == fileKey (keyFile k)
|
||||
prop_idempotent_fileKey s
|
||||
| null s = True -- it's not legal for a key to have no keyName
|
||||
| otherwise= Just k == fileKey (keyFile k)
|
||||
where
|
||||
k = stubKey { keyName = s, keyBackendName = "test" }
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue