From e34d1a385e2d7fcfd495fc080afef92f4f6429c9 Mon Sep 17 00:00:00 2001 From: Ramakrishnan Muthukrishnan <ram@rkrishnan.org> Date: Tue, 25 Jul 2017 12:55:20 +0530 Subject: [PATCH] Metainfo: Info may or may not be present --- src/FuncTorrent/Metainfo.hs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/FuncTorrent/Metainfo.hs b/src/FuncTorrent/Metainfo.hs index 13e7979..e555074 100644 --- a/src/FuncTorrent/Metainfo.hs +++ b/src/FuncTorrent/Metainfo.hs @@ -41,7 +41,7 @@ data Info = Info { pieceLength :: !Integer , md5sum :: !(Maybe String) } deriving (Eq, Show) -data Metainfo = Metainfo { info :: !Info +data Metainfo = Metainfo { info :: !(Maybe Info) , announceList :: ![String] , creationDate :: !(Maybe Integer) , comment :: !(Maybe String) @@ -67,7 +67,7 @@ mkInfo _ = Nothing mkMetaInfo :: BVal -> Either String Metainfo mkMetaInfo (Bdict m) = - let (Just info') = mkInfo $ m ! "info" + let info' = mkInfo $ m ! "info" announce' = lookup "announce" m announceList' = lookup "announce-list" m creationDate' = lookup "creation date" m -- 2.45.2