summaryrefslogtreecommitdiff
path: root/Types/UUID.hs
diff options
context:
space:
mode:
authorJoey Hess <joeyh@joeyh.name>2019-03-06 14:57:36 -0400
committerJoey Hess <joeyh@joeyh.name>2019-03-06 15:44:27 -0400
commitc6c5f6336bdd12cabda9ca0c5724e9617e9a64e0 (patch)
tree0477f9474317f1ddc91e6e3edf4ab38e9e040ece /Types/UUID.hs
parent6ef38df88125441e6de2f0d741095ff50fe38beb (diff)
avoid whitespace in Arbitrary UUID and empty UUID
Diffstat (limited to 'Types/UUID.hs')
-rw-r--r--Types/UUID.hs6
1 files changed, 5 insertions, 1 deletions
diff --git a/Types/UUID.hs b/Types/UUID.hs
index 61bfab06dd..0bb2e72c31 100644
--- a/Types/UUID.hs
+++ b/Types/UUID.hs
@@ -90,4 +90,8 @@ instance Arbitrary UUID where
-- Avoid non-ascii because fully arbitrary
-- strings may not be encoded using the filesystem
-- encoding, which is normally applied to all input.
- arb = encodeBS <$> arbitrary `suchThat` all isAscii
+ -- Avoid whitespace because UUIDs are used in log files.
+ -- Avoid empty because that's NoUUID
+ arb = encodeBS . getNonEmpty <$> arbitrary
+ `suchThat` (all isAscii . getNonEmpty)
+ `suchThat` (all (not . isSpace) . getNonEmpty)