aboutsummaryrefslogtreecommitdiff
path: root/Command/ImportFeed.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2013-07-28 20:14:13 -0400
committerGravatar Joey Hess <joey@kitenet.net>2013-07-28 20:14:13 -0400
commit7ac458b44c0635dd75b127437c605b6d8dbfda36 (patch)
tree67eda865c24cd3a1c26bbd43e866cf6acaa3ee0e /Command/ImportFeed.hs
parent1d1ad341a161ca352d967fa64449f23335fecf54 (diff)
fix bug in makeUnique
Returned the possibly non-unique file
Diffstat (limited to 'Command/ImportFeed.hs')
-rw-r--r--Command/ImportFeed.hs6
1 files changed, 3 insertions, 3 deletions
diff --git a/Command/ImportFeed.hs b/Command/ImportFeed.hs
index 682a7faa1..9094ce95b 100644
--- a/Command/ImportFeed.hs
+++ b/Command/ImportFeed.hs
@@ -121,7 +121,7 @@ defaultTemplate = "${feedtitle}/${itemtitle}${extension}"
- has the same title. A number is added to disambiguate.
-}
feedFile :: Utility.Format.Format -> ToDownload -> IO FilePath
-feedFile tmpl i = makeUnique 0 $
+feedFile tmpl i = makeUnique 1 $
Utility.Format.format tmpl $ M.fromList
[ field "feedtitle" $ getFeedTitle $ feed i
, fieldMaybe "itemtitle" $ getItemTitle $ item i
@@ -148,10 +148,10 @@ makeUnique :: Integer -> FilePath -> IO FilePath
makeUnique n file =
ifM (isJust <$> catchMaybeIO (getSymbolicLinkStatus f))
( makeUnique (n + 1) file
- , return file
+ , return f
)
where
- f = if n == 0
+ f = if n < 2
then file
else
let (d, base) = splitFileName file