addurl: Normalize badly encoded urls.

This commit is contained in:
Joey Hess 2012-02-09 14:19:58 -04:00
parent ac97454659
commit 1c0bd81ba6
2 changed files with 5 additions and 3 deletions

View file

@ -31,10 +31,11 @@ seek = [withField fileOption return $ \f ->
withStrings $ start f] withStrings $ start f]
start :: Maybe FilePath -> String -> CommandStart start :: Maybe FilePath -> String -> CommandStart
start optfile s = notBareRepo $ go $ parseURI s start optfile s = notBareRepo $ go $ fromMaybe bad $ parseURI s
where where
go Nothing = error $ "bad url " ++ s bad = fromMaybe (error $ "bad url " ++ s) $
go (Just url) = do parseURI $ escapeURIString isUnescapedInURI s
go url = do
let file = fromMaybe (url2file url) optfile let file = fromMaybe (url2file url) optfile
showStart "addurl" file showStart "addurl" file
next $ perform s file next $ perform s file

1
debian/changelog vendored
View file

@ -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. 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 Or, when the file already exists, the url is recorded as another
location of the file. location of the file.
* addurl: Normalize badly encoded urls.
-- Joey Hess <joeyh@debian.org> Tue, 24 Jan 2012 16:21:55 -0400 -- Joey Hess <joeyh@debian.org> Tue, 24 Jan 2012 16:21:55 -0400