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
|
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
|
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.
|
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
|
-- Joey Hess <id@joeyh.name> Sat, 15 Jun 2019 12:38:25 -0400
|
||||||
|
|
||||||
|
|
|
@ -21,6 +21,7 @@ import Data.Time.Format
|
||||||
import System.Locale
|
import System.Locale
|
||||||
#endif
|
#endif
|
||||||
import qualified Data.Text as T
|
import qualified Data.Text as T
|
||||||
|
import System.Log.Logger
|
||||||
|
|
||||||
import Command
|
import Command
|
||||||
import qualified Annex
|
import qualified Annex
|
||||||
|
@ -75,11 +76,9 @@ getFeed opts cache url = do
|
||||||
Nothing -> showEndResult =<< feedProblem url
|
Nothing -> showEndResult =<< feedProblem url
|
||||||
"downloading the feed failed"
|
"downloading the feed failed"
|
||||||
Just feedcontent -> case parseFeedString feedcontent of
|
Just feedcontent -> case parseFeedString feedcontent of
|
||||||
Nothing -> showEndResult =<< feedProblem url
|
Nothing -> debugfeedcontent feedcontent "parsing the feed failed"
|
||||||
"parsing the feed failed"
|
|
||||||
Just f -> case findDownloads url f of
|
Just f -> case findDownloads url f of
|
||||||
[] -> showEndResult =<< feedProblem url
|
[] -> debugfeedcontent feedcontent "bad feed content; no enclosures to download"
|
||||||
"bad feed content; no enclosures to download"
|
|
||||||
l -> do
|
l -> do
|
||||||
showEndOk
|
showEndOk
|
||||||
ifM (and <$> mapM (performDownload opts cache) l)
|
ifM (and <$> mapM (performDownload opts cache) l)
|
||||||
|
@ -87,6 +86,15 @@ getFeed opts cache url = do
|
||||||
, void $ feedProblem url
|
, void $ feedProblem url
|
||||||
"problem downloading some item(s) from feed"
|
"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
|
data ToDownload = ToDownload
|
||||||
{ feed :: Feed
|
{ feed :: Feed
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue