aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2016-05-27 13:14:51 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2016-05-27 13:14:51 -0400
commit38bd7ca3cce455c20edcee656c706939087c6a69 (patch)
tree852256db56777c1511d093f051a04961cab66380
parent83211d99a949e91698eb30ad9fffff64c2b3eb83 (diff)
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.
-rw-r--r--Backend/Hash.hs5
-rw-r--r--CHANGELOG6
-rw-r--r--doc/bugs/strips___95___from_extensions_in_E_backends__63__.mdwn2
3 files changed, 11 insertions, 2 deletions
diff --git a/Backend/Hash.hs b/Backend/Hash.hs
index fd51d87ce..ba8d4bc64 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 5b1502e06..ff09e72aa 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -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
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 30bda2b23..e0785b30b 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]]