fix leading period before two-element extensions
This commit is contained in:
parent
2c4b39be4f
commit
8ad844e45c
1 changed files with 6 additions and 2 deletions
|
@ -102,9 +102,13 @@ keyValueE size source = keyValue size source >>= maybe (return Nothing) addE
|
||||||
}
|
}
|
||||||
|
|
||||||
selectExtension :: FilePath -> String
|
selectExtension :: FilePath -> String
|
||||||
selectExtension = join "." . reverse . take 2 . takeWhile shortenough .
|
selectExtension f
|
||||||
reverse . split "." . takeExtensions
|
| null es = ""
|
||||||
|
| otherwise = join "." ("":es)
|
||||||
where
|
where
|
||||||
|
es = filter (not . null) $ reverse $
|
||||||
|
take 2 $ takeWhile shortenough $
|
||||||
|
reverse $ split "." $ takeExtensions f
|
||||||
shortenough e
|
shortenough e
|
||||||
| '\n' `elem` e = False -- newline in extension?!
|
| '\n' `elem` e = False -- newline in extension?!
|
||||||
| otherwise = length e <= 4 -- long enough for "jpeg"
|
| otherwise = length e <= 4 -- long enough for "jpeg"
|
||||||
|
|
Loading…
Reference in a new issue