summaryrefslogtreecommitdiff
path: root/Command
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2012-02-09 14:19:58 -0400
committerGravatar Joey Hess <joey@kitenet.net>2012-02-09 14:19:58 -0400
commit1c0bd81ba6aa6bd081042c81fcb6dca21ece0eec (patch)
tree2ebaa6b512f479e7d8fe7ecb8e1ee8eb48df2027 /Command
parentac9745465954d77d7215e4d7411a3c218203643d (diff)
addurl: Normalize badly encoded urls.
Diffstat (limited to 'Command')
-rw-r--r--Command/AddUrl.hs7
1 files changed, 4 insertions, 3 deletions
diff --git a/Command/AddUrl.hs b/Command/AddUrl.hs
index 2f157c7fd..496b9f2e8 100644
--- a/Command/AddUrl.hs
+++ b/Command/AddUrl.hs
@@ -31,10 +31,11 @@ seek = [withField fileOption return $ \f ->
withStrings $ start f]
start :: Maybe FilePath -> String -> CommandStart
-start optfile s = notBareRepo $ go $ parseURI s
+start optfile s = notBareRepo $ go $ fromMaybe bad $ parseURI s
where
- go Nothing = error $ "bad url " ++ s
- go (Just url) = do
+ bad = fromMaybe (error $ "bad url " ++ s) $
+ parseURI $ escapeURIString isUnescapedInURI s
+ go url = do
let file = fromMaybe (url2file url) optfile
showStart "addurl" file
next $ perform s file