addurl, importfeed: Sanitize | and some other symbols and special characters.
This commit is contained in:
parent
fac770a1a0
commit
7f6685c16e
3 changed files with 8 additions and 3 deletions
|
@ -242,13 +242,13 @@ fileNameLengthLimit dir = do
|
|||
- was provided by a third party and is not to be trusted, returns the closest
|
||||
- sane FilePath.
|
||||
-
|
||||
- All spaces and punctuation are replaced with '_', except for '.'
|
||||
- "../" will thus turn into ".._", which is safe.
|
||||
- All spaces and punctuation and other wacky stuff are replaced
|
||||
- with '_', except for '.' "../" will thus turn into ".._", which is safe.
|
||||
-}
|
||||
sanitizeFilePath :: String -> FilePath
|
||||
sanitizeFilePath = map sanitize
|
||||
where
|
||||
sanitize c
|
||||
| c == '.' = c
|
||||
| isSpace c || isPunctuation c || c == '/' = '_'
|
||||
| isSpace c || isPunctuation c || isSymbol c || isControl c || c == '/' = '_'
|
||||
| otherwise = c
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue