Fix build with old versions of feed library

This commit is contained in:
Joey Hess 2021-11-23 16:06:51 -04:00
parent 95f78cc1ce
commit 1d513540e9
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
2 changed files with 15 additions and 1 deletions

View file

@ -1,3 +1,9 @@
git-annex (8.20211124) UNRELEASED; urgency=medium
* Fix build with old versions of feed library.
-- Joey Hess <id@joeyh.name> Tue, 23 Nov 2021 15:58:27 -0400
git-annex (8.20211123) upstream; urgency=medium
* Bugfix: When -J was enabled, getting files could leak an

View file

@ -7,6 +7,7 @@
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE CPP #-}
module Command.ImportFeed where
@ -88,7 +89,7 @@ getFeed addunlockedmatcher opts cache url = do
where
-- Use parseFeedFromFile rather than reading the file
-- ourselves because it goes out of its way to handle encodings.
go tmpf = liftIO (parseFeedFromFile tmpf) >>= \case
go tmpf = liftIO (parseFeedFromFile' tmpf) >>= \case
Nothing -> debugfeedcontent tmpf "parsing the feed failed"
Just f -> case findDownloads url f of
[] -> debugfeedcontent tmpf "bad feed content; no enclosures to download"
@ -109,6 +110,13 @@ getFeed addunlockedmatcher opts cache url = do
showEndResult =<< feedProblem url
(msg ++ " (use --debug --debugfilter=ImportFeed to see the feed content that was downloaded)")
parseFeedFromFile' :: FilePath -> IO (Maybe Feed)
#if MIN_VERSION_feed(1,1,0)
parseFeedFromFile' = parseFeedFromFile
#else
parseFeedFromFile' f = catchMaybeIO (parseFeedFromFile f)
#endif
data ToDownload = ToDownload
{ feed :: Feed
, feedurl :: URLString