avoid too long filename when making up a filename for addurl too

This commit is contained in:
Joey Hess 2012-02-16 02:09:09 -04:00
parent 8f9b501515
commit a86d937b5b

View file

@ -81,7 +81,7 @@ nodownload url file = do
next $ Command.Add.cleanup file key False next $ Command.Add.cleanup file key False
url2file :: URI -> FilePath url2file :: URI -> FilePath
url2file url = escape $ uriRegName auth ++ uriPath url ++ uriQuery url url2file url = take 255 $ escape $ uriRegName auth ++ uriPath url ++ uriQuery url
where where
escape = replace "/" "_" . replace "?" "_" escape = replace "/" "_" . replace "?" "_"
auth = fromMaybe (error $ "bad url " ++ show url) $ uriAuthority url auth = fromMaybe (error $ "bad url " ++ show url) $ uriAuthority url