addurl, importfeed: Sanitize | and some other symbols and special characters.

This commit is contained in:
Joey Hess 2013-12-27 17:52:20 -04:00
parent fac770a1a0
commit 7f6685c16e
3 changed files with 8 additions and 3 deletions

View file

@ -242,13 +242,13 @@ fileNameLengthLimit dir = do
- was provided by a third party and is not to be trusted, returns the closest - was provided by a third party and is not to be trusted, returns the closest
- sane FilePath. - sane FilePath.
- -
- All spaces and punctuation are replaced with '_', except for '.' - All spaces and punctuation and other wacky stuff are replaced
- "../" will thus turn into ".._", which is safe. - with '_', except for '.' "../" will thus turn into ".._", which is safe.
-} -}
sanitizeFilePath :: String -> FilePath sanitizeFilePath :: String -> FilePath
sanitizeFilePath = map sanitize sanitizeFilePath = map sanitize
where where
sanitize c sanitize c
| c == '.' = c | c == '.' = c
| isSpace c || isPunctuation c || c == '/' = '_' | isSpace c || isPunctuation c || isSymbol c || isControl c || c == '/' = '_'
| otherwise = c | otherwise = c

2
debian/changelog vendored
View file

@ -8,6 +8,8 @@ git-annex (5.20131222) UNRELEASED; urgency=medium
in the Linux standalone build, and OSX app, so they will be available in the Linux standalone build, and OSX app, so they will be available
when it's added to PATH. when it's added to PATH.
* Added new external special remote interface. * Added new external special remote interface.
* addurl, importfeed: Sanitize | and some other symbols and special
characters.
-- Joey Hess <joeyh@debian.org> Tue, 24 Dec 2013 13:54:32 -0400 -- Joey Hess <joeyh@debian.org> Tue, 24 Dec 2013 13:54:32 -0400

View file

@ -22,3 +22,6 @@ git annex addurl will keep the »|« symbol in the filename generated from the v
Ubuntu 13.10 Ubuntu 13.10
### Please provide any additional information below. ### Please provide any additional information below.
> Ah, I see, pipe is not considered to be punctuation, but a math symbol.
> [[fixed|done]] --[[Joey]]