From f2846d803c710befdd2405d5fd15a23a0d4e2c3a Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Tue, 5 Oct 2021 20:25:51 -0400 Subject: [PATCH] remove old and uncessary sanity check All backends use genKeyName, which uses preSanitizeKeyName, which will escape newlines. I suspect this newline prevention was added back when git-annex was reading the output of sha1sum.. Sponsored-by: Kevin Mueller on Patreon --- Backend.hs | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/Backend.hs b/Backend.hs index 3a00115368..1c6bc80e06 100644 --- a/Backend.hs +++ b/Backend.hs @@ -62,17 +62,9 @@ genKey source meterupdate preferredbackend = do case B.genKey b of Just a -> do k <- a source meterupdate - return (makesane k, b) + return (k, b) Nothing -> giveup $ "Cannot generate a key for backend " ++ decodeBS (formatKeyVariety (B.backendVariety b)) - where - -- keyNames should not contain newline characters. - makesane k = alterKey k $ \d -> d - { keyName = S.toShort (S8.map fixbadchar (S.fromShort (fromKey keyName k))) - } - fixbadchar c - | c == '\n' = '_' - | otherwise = c getBackend :: FilePath -> Key -> Annex (Maybe Backend) getBackend file k = maybeLookupBackendVariety (fromKey keyVariety k) >>= \case