diff options
Diffstat (limited to 'Command')
-rw-r--r-- | Command/ImportFeed.hs | 20 |
1 files changed, 11 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 |