diff options
author | Joey Hess <joeyh@joeyh.name> | 2014-12-17 14:07:05 -0400 |
---|---|---|
committer | Joey Hess <joeyh@joeyh.name> | 2014-12-17 14:07:05 -0400 |
commit | aade3c08e5089c2fdd263427efe322deea348cbc (patch) | |
tree | 352a2575d279365ca656473b7c89208fe81be2e5 /Remote | |
parent | 16dfb953454a24d06e8ae223b762fc0e078b0918 (diff) |
fix torrentUrlNum when there is no #n
Diffstat (limited to 'Remote')
-rw-r--r-- | Remote/BitTorrent.hs | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/Remote/BitTorrent.hs b/Remote/BitTorrent.hs index 1e90717f5..9b055b19b 100644 --- a/Remote/BitTorrent.hs +++ b/Remote/BitTorrent.hs @@ -149,9 +149,11 @@ torrentUrlWithNum :: URLString -> Int -> URLString torrentUrlWithNum u n = u ++ "#" ++ show n torrentUrlNum :: URLString -> (URLString, Int) -torrentUrlNum u = - let (n, ru) = separate (== '#') (reverse u) - in (reverse ru, fromMaybe 1 $ readish $ reverse n) +torrentUrlNum u + | '#' `elem` u = + let (n, ru) = separate (== '#') (reverse u) + in (reverse ru, fromMaybe 1 $ readish $ reverse n) + | otherwise = (u, 1) {- A Key corresponding to the URL of a torrent file. -} torrentUrlKey :: URLString -> Annex Key |