diff options
-rw-r--r-- | Command/ImportFeed.hs | 20 | ||||
-rw-r--r-- | debian/changelog | 1 | ||||
-rw-r--r-- | doc/bugs/importfeed_fails_with_local_file_urls.mdwn | 7 |
3 files changed, 19 insertions, 9 deletions
diff --git a/Command/ImportFeed.hs b/Command/ImportFeed.hs index ed3c3bcd3..2a278dea1 100644 --- a/Command/ImportFeed.hs +++ b/Command/ImportFeed.hs @@ -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 diff --git a/debian/changelog b/debian/changelog index 3c4f0d1bb..557d3eb6b 100644 --- a/debian/changelog +++ b/debian/changelog @@ -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 diff --git a/doc/bugs/importfeed_fails_with_local_file_urls.mdwn b/doc/bugs/importfeed_fails_with_local_file_urls.mdwn index 5984458ab..932848ddf 100644 --- a/doc/bugs/importfeed_fails_with_local_file_urls.mdwn +++ b/doc/bugs/importfeed_fails_with_local_file_urls.mdwn @@ -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]] |