Improve SHA*E extension extraction code.

Filter out over-long "extensions" before stripping out non-alphanumerics
from them, so that eg "foo.ba__________r" is not considered a .bar
extension.
This commit is contained in:
Joey Hess 2016-05-27 13:14:51 -04:00
parent d2fa4a6873
commit 45308ec78b
Failed to extract signature
3 changed files with 11 additions and 2 deletions

View file

@ -101,8 +101,9 @@ selectExtension f
| otherwise = intercalate "." ("":es)
where
es = filter (not . null) $ reverse $
take 2 $ takeWhile shortenough $
reverse $ split "." $ filter validInExtension $ takeExtensions f
take 2 $ map (filter validInExtension) $
takeWhile shortenough $
reverse $ split "." $ takeExtensions f
shortenough e = length e <= 4 -- long enough for "jpeg"
{- A key's checksum is checked during fsck. -}

View file

@ -1,3 +1,9 @@
git-annex (6.20160528) UNRELEASED; urgency=medium
* Improve SHA*E extension extraction code.
-- Joey Hess <id@joeyh.name> Fri, 27 May 2016 13:12:48 -0400
git-annex (6.20160527) unstable; urgency=medium
* Split lines in the git-annex branch on \r as well as \n, to deal

View file

@ -13,3 +13,5 @@ lrwxrwxrwx 1 yoh yoh 126 May 25 14:27 ds001_R1.1.0_raw.tgz -> .git/annex/objects
"""]]
[[!meta author=yoh]]
> [[fixed|done]] --[[Joey]]