diff options
author | 2015-05-30 02:08:49 -0400 | |
---|---|---|
committer | 2015-05-30 02:08:49 -0400 | |
commit | f5060c9334cc0c96f11ee085b74d290c2b1d00db (patch) | |
tree | a93b2a7613c8153c8a3b18eb68d84648a976ae33 /Types/Key.hs | |
parent | 50301b7bda1854f571b87f3357ee00d6c625af56 (diff) |
fromkey, registerurl: Improve handling of urls that happen to also be parsable as strange keys.
Diffstat (limited to 'Types/Key.hs')
-rw-r--r-- | Types/Key.hs | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/Types/Key.hs b/Types/Key.hs index 037437303..553fd8f3d 100644 --- a/Types/Key.hs +++ b/Types/Key.hs @@ -16,6 +16,7 @@ module Types.Key ( nonChunkKey, chunkKeyOffset, isChunkKey, + isKeyPrefix, prop_idempotent_key_encode, prop_idempotent_key_decode @@ -66,6 +67,10 @@ chunkKeyOffset k = (*) isChunkKey :: Key -> Bool isChunkKey k = isJust (keyChunkSize k) && isJust (keyChunkNum k) +-- Checks if a string looks like at least the start of a key. +isKeyPrefix :: String -> Bool +isKeyPrefix s = [fieldSep, fieldSep] `isInfixOf` s + fieldSep :: Char fieldSep = '-' |