From 1c0bd81ba6aa6bd081042c81fcb6dca21ece0eec Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Thu, 9 Feb 2012 14:19:58 -0400 Subject: addurl: Normalize badly encoded urls. --- Command/AddUrl.hs | 7 ++++--- debian/changelog | 1 + 2 files changed, 5 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 diff --git a/debian/changelog b/debian/changelog index 2f9d79939..ad1fe1945 100644 --- a/debian/changelog +++ b/debian/changelog @@ -16,6 +16,7 @@ git-annex (3.20120124) UNRELEASED; urgency=low filename that is used when adding an url, which is based on the url. Or, when the file already exists, the url is recorded as another location of the file. + * addurl: Normalize badly encoded urls. -- Joey Hess Tue, 24 Jan 2012 16:21:55 -0400 -- cgit v1.2.3