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
This commit is contained in:
Joey Hess 2021-10-05 20:25:51 -04:00
parent 19e78816f0
commit f2846d803c
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38

View file

@ -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