importfeed: Error out when passed a non-url.
This commit is contained in:
parent
aa31af5594
commit
3695094454
3 changed files with 19 additions and 9 deletions
|
@ -146,15 +146,17 @@ findDownloads u = go =<< downloadFeed u
|
|||
|
||||
{- Feeds change, so a feed download cannot be resumed. -}
|
||||
downloadFeed :: URLString -> Annex (Maybe Feed)
|
||||
downloadFeed url = do
|
||||
showOutput
|
||||
uo <- Url.getUrlOptions
|
||||
liftIO $ withTmpFile "feed" $ \f h -> do
|
||||
hClose h
|
||||
ifM (Url.download url f uo)
|
||||
( parseFeedString <$> readFileStrictAnyEncoding f
|
||||
, return Nothing
|
||||
)
|
||||
downloadFeed url
|
||||
| Url.parseURIRelaxed url == Nothing = error "invalid feed url"
|
||||
| otherwise = do
|
||||
showOutput
|
||||
uo <- Url.getUrlOptions
|
||||
liftIO $ withTmpFile "feed" $ \f h -> do
|
||||
hClose h
|
||||
ifM (Url.download url f uo)
|
||||
( parseFeedString <$> readFileStrictAnyEncoding f
|
||||
, return Nothing
|
||||
)
|
||||
|
||||
performDownload :: Opts -> Cache -> ToDownload -> Annex Bool
|
||||
performDownload opts cache todownload = case location todownload of
|
||||
|
|
1
debian/changelog
vendored
1
debian/changelog
vendored
|
@ -13,6 +13,7 @@ git-annex (5.20150406.2) UNRELEASED; urgency=medium
|
|||
* info: Display repository mode: bare when in a bare (non-direct mode)
|
||||
repo.
|
||||
* importfeed: Fix feed download when curl is used.
|
||||
* importfeed: Error out when passed a non-url.
|
||||
|
||||
-- Joey Hess <id@joeyh.name> Mon, 06 Apr 2015 20:14:20 -0400
|
||||
|
||||
|
|
|
@ -26,3 +26,10 @@ Is it possible to use local files in rss format with items which reference local
|
|||
|
||||
Cheers,
|
||||
Marco
|
||||
|
||||
> I've fixed it with file:// urls.
|
||||
>
|
||||
> Also made it error out on non-url feed inputs, which are not intended to be
|
||||
> supported.
|
||||
>
|
||||
> [[done]] --[[Joey]]
|
||||
|
|
Loading…
Reference in a new issue