addurl --fast error message improvement
addurl: When run with --fast on an url that annex.security.allowed-ip-addresses prevents accessing, display a more useful message. (Also importfeed --fast potentially.)
This commit is contained in:
parent
9b1e4de31a
commit
19b5137227
5 changed files with 54 additions and 30 deletions
|
@ -194,11 +194,16 @@ startWeb addunlockedmatcher o urlstring = go $ fromMaybe bad $ parseURI urlstrin
|
|||
where
|
||||
bad = fromMaybe (giveup $ "bad url " ++ urlstring) $
|
||||
Url.parseURIRelaxed $ urlstring
|
||||
go url = startingAddUrl urlstring o $ do
|
||||
go url = startingAddUrl urlstring o $
|
||||
if relaxedOption (downloadOptions o)
|
||||
then go' url Url.assumeUrlExists
|
||||
else Url.withUrlOptions (Url.getUrlInfo urlstring) >>= \case
|
||||
Right urlinfo -> go' url urlinfo
|
||||
Left err -> do
|
||||
warning err
|
||||
next $ return False
|
||||
go' url urlinfo = do
|
||||
pathmax <- liftIO $ fileNameLengthLimit "."
|
||||
urlinfo <- if relaxedOption (downloadOptions o)
|
||||
then pure Url.assumeUrlExists
|
||||
else Url.withUrlOptions $ Url.getUrlInfo urlstring
|
||||
file <- adjustFile o <$> case fileOption (downloadOptions o) of
|
||||
Just f -> pure f
|
||||
Nothing -> case Url.urlSuggestedFile urlinfo of
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue