addurl: Better sanitization of generated filenames.

Use sanitizeFilePath rather than rolling our own sanitizer.
This commit is contained in:
Joey Hess 2013-10-05 13:30:13 -04:00
parent cf428895a2
commit 478eeea02e
2 changed files with 3 additions and 2 deletions

View file

@ -223,6 +223,6 @@ url2file url pathdepth pathmax = case pathdepth of
where
fullurl = uriRegName auth ++ uriPath url ++ uriQuery url
frombits a = intercalate "/" $ a urlbits
urlbits = map (truncateFilePath pathmax . escape) $ filter (not . null) $ split "/" fullurl
urlbits = map (truncateFilePath pathmax . sanitizeFilePath) $
filter (not . null) $ split "/" fullurl
auth = fromMaybe (error $ "bad url " ++ show url) $ uriAuthority url
escape = replace "/" "_" . replace "?" "_"