importfeed: When there's a problem parsing the feed, --debug will output the feed content that was downloaded.
And let the user know about it in the failure messages.
This commit is contained in:
parent
759fd9ea68
commit
7264203eb1
2 changed files with 14 additions and 4 deletions
|
@ -10,6 +10,8 @@ git-annex (7.20190616) UNRELEASED; urgency=medium
|
|||
avoid using http range to resume, since a range "bytes=0-" is an unusual
|
||||
edge case that it's best to avoid relying on working. This is known to
|
||||
fix a case where importfeed downloaded a partial feed from such a server.
|
||||
* importfeed: When there's a problem parsing the feed, --debug will
|
||||
output the feed content that was downloaded.
|
||||
|
||||
-- Joey Hess <id@joeyh.name> Sat, 15 Jun 2019 12:38:25 -0400
|
||||
|
||||
|
|
|
@ -21,6 +21,7 @@ import Data.Time.Format
|
|||
import System.Locale
|
||||
#endif
|
||||
import qualified Data.Text as T
|
||||
import System.Log.Logger
|
||||
|
||||
import Command
|
||||
import qualified Annex
|
||||
|
@ -75,11 +76,9 @@ getFeed opts cache url = do
|
|||
Nothing -> showEndResult =<< feedProblem url
|
||||
"downloading the feed failed"
|
||||
Just feedcontent -> case parseFeedString feedcontent of
|
||||
Nothing -> showEndResult =<< feedProblem url
|
||||
"parsing the feed failed"
|
||||
Nothing -> debugfeedcontent feedcontent "parsing the feed failed"
|
||||
Just f -> case findDownloads url f of
|
||||
[] -> showEndResult =<< feedProblem url
|
||||
"bad feed content; no enclosures to download"
|
||||
[] -> debugfeedcontent feedcontent "bad feed content; no enclosures to download"
|
||||
l -> do
|
||||
showEndOk
|
||||
ifM (and <$> mapM (performDownload opts cache) l)
|
||||
|
@ -87,6 +86,15 @@ getFeed opts cache url = do
|
|||
, void $ feedProblem url
|
||||
"problem downloading some item(s) from feed"
|
||||
)
|
||||
where
|
||||
debugfeedcontent feedcontent msg = do
|
||||
liftIO $ debugM "feed content" $ unlines
|
||||
[ "start of feed content"
|
||||
, feedcontent
|
||||
, "end of feed content"
|
||||
]
|
||||
showEndResult =<< feedProblem url
|
||||
(msg ++ " (use --debug to see the feed content that was downloaded)")
|
||||
|
||||
data ToDownload = ToDownload
|
||||
{ feed :: Feed
|
||||
|
|
Loading…
Reference in a new issue