diff options
author | Joey Hess <joey@kitenet.net> | 2013-10-16 12:46:24 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2013-10-16 12:46:24 -0400 |
commit | 3a31b000bbe0db0948f0422020f7381909b93e57 (patch) | |
tree | 9fc63f92be8415d15bd4ac82f47b9079683092ed /Locations.hs | |
parent | 12a038aa806f16004f4e4afa8f3ee9fa752eae29 (diff) |
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.
Diffstat (limited to 'Locations.hs')
-rw-r--r-- | Locations.hs | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/Locations.hs b/Locations.hs index 47607c577..b96f58d5f 100644 --- a/Locations.hs +++ b/Locations.hs @@ -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" } |