summaryrefslogtreecommitdiff
path: root/src/Data/Torrent
diff options
context:
space:
mode:
authorSam Truzjan <pxqr.sta@gmail.com>2013-12-27 05:36:45 +0400
committerSam Truzjan <pxqr.sta@gmail.com>2013-12-27 05:36:45 +0400
commite06b3dbd76a0a76c872ca27b4ea33b4465d14da3 (patch)
treef797719a25bce95a95a3b30e02b50af7a7e7520a /src/Data/Torrent
parent89151d4315631243840fcae54244c144ff42329d (diff)
Fix get_peers response encoding
Diffstat (limited to 'src/Data/Torrent')
-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