summaryrefslogtreecommitdiff
path: root/Remote/BitTorrent.hs
diff options
context:
space:
mode:
Diffstat (limited to 'Remote/BitTorrent.hs')
-rw-r--r--Remote/BitTorrent.hs8
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