summaryrefslogtreecommitdiff
path: root/src/Data
diff options
context:
space:
mode:
Diffstat (limited to 'src/Data')
-rw-r--r--src/Data/Torrent/InfoHash.hs1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/Data/Torrent/InfoHash.hs b/src/Data/Torrent/InfoHash.hs
index 4d49fcb7..9eec631c 100644
--- a/src/Data/Torrent/InfoHash.hs
+++ b/src/Data/Torrent/InfoHash.hs
@@ -120,6 +120,7 @@ instance Convertible BS.ByteString InfoHash where
120-- | Parse infohash from base16\/base32\/base64 encoded string. 120-- | Parse infohash from base16\/base32\/base64 encoded string.
121instance Convertible Text InfoHash where 121instance Convertible Text InfoHash where
122 safeConvert t 122 safeConvert t
123 | 20 == hashLen = pure (InfoHash hashStr)
123 | 26 <= hashLen && hashLen <= 28 = 124 | 26 <= hashLen && hashLen <= 28 =
124 case Base64.decode hashStr of 125 case Base64.decode hashStr of
125 Left msg -> convError ("invalid base64 encoding " ++ msg) t 126 Left msg -> convError ("invalid base64 encoding " ++ msg) t