From 45308ec78b759e207b6624157a4947ee8cd00464 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Fri, 27 May 2016 13:14:51 -0400 Subject: [PATCH] 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. --- Backend/Hash.hs | 5 +++-- CHANGELOG | 6 ++++++ .../strips___95___from_extensions_in_E_backends__63__.mdwn | 2 ++ 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/Backend/Hash.hs b/Backend/Hash.hs index fd51d87cea..ba8d4bc641 100644 --- a/Backend/Hash.hs +++ b/Backend/Hash.hs @@ -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. -} diff --git a/CHANGELOG b/CHANGELOG index 5b1502e06b..ff09e72aad 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,9 @@ +git-annex (6.20160528) UNRELEASED; urgency=medium + + * Improve SHA*E extension extraction code. + + -- Joey Hess 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 diff --git a/doc/bugs/strips___95___from_extensions_in_E_backends__63__.mdwn b/doc/bugs/strips___95___from_extensions_in_E_backends__63__.mdwn index 30bda2b234..e0785b30b8 100644 --- a/doc/bugs/strips___95___from_extensions_in_E_backends__63__.mdwn +++ b/doc/bugs/strips___95___from_extensions_in_E_backends__63__.mdwn @@ -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]]