fix / escape

This commit is contained in:
Joey Hess 2011-09-09 00:11:32 -04:00
parent 03d6209e1c
commit e4ba0934c2

View file

@ -79,8 +79,9 @@ url2file :: URI -> IO FilePath
url2file url = do
whenM (doesFileExist file) $
error $ "already have this url in " ++ file
liftIO $ print file
return file
where
file = escape $ uriRegName auth ++ uriPath url ++ uriQuery url
escape = replace "/?" $ repeat '_'
escape = replace "/" "_" . replace "?" "_"
auth = fromMaybe (error $ "bad url " ++ show url) $ uriAuthority url