display error when an invalid url is downloaded

download is documented as displaying an error when download fails, but
it didn't when the url was not valid at all. That leads to confusing
behavior.

Also, display the url with --debug
This commit is contained in:
Joey Hess 2018-09-25 13:38:20 -04:00
parent 92cef3051b
commit 26a02cb386
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
3 changed files with 25 additions and 1 deletions

View file

@ -311,7 +311,10 @@ download meterupdate url file uo =
(DownloadWithCurl _, _)
| isfileurl u -> downloadfile u
| otherwise -> downloadcurl
Nothing -> return False
Nothing -> do
liftIO $ debugM "url" url
hPutStrLn stderr "download failed: invalid url"
return False
isfileurl u = uriScheme u == "file:"