add dropFromEnd

This commit is contained in:
Joey Hess 2018-11-23 11:24:05 -04:00
parent acb4bcf2db
commit 850d19d038
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
5 changed files with 10 additions and 6 deletions

View file

@ -278,8 +278,7 @@ getUrlInfo url uo = case parseURIRelaxed url of
contentDispositionFilename :: String -> Maybe FilePath
contentDispositionFilename s
| "attachment; filename=\"" `isPrefixOf` s && "\"" `isSuffixOf` s =
Just $ reverse $ drop 1 $ reverse $
drop 1 $ dropWhile (/= '"') s
Just $ dropFromEnd 1 $ drop 1 $ dropWhile (/= '"') s
| otherwise = Nothing
headRequest :: Request -> Request