Prevent key names from containing newlines.
There are several places where it's assumed a key can be written on one line. One is in the format of the .git/annex/unused files. The difficult one is that filenames derived from keys are fed into git cat-file --batch, which has a line based input. (And no -z option.) So, for now it's best to block such keys being created.
This commit is contained in:
parent
cf5353acb4
commit
480495beb4
4 changed files with 16 additions and 5 deletions
|
@ -90,10 +90,12 @@ keyValueE size file = keyValue size file >>= maybe (return Nothing) addE
|
|||
, keyBackendName = shaNameE size
|
||||
}
|
||||
naiveextension = takeExtension file
|
||||
extension =
|
||||
if length naiveextension > 6
|
||||
then "" -- probably not really an extension
|
||||
else naiveextension
|
||||
extension
|
||||
-- long or newline containing extensions are
|
||||
-- probably not really an extension
|
||||
| length naiveextension > 6 ||
|
||||
'\n' `elem` naiveextension = ""
|
||||
| otherwise = naiveextension
|
||||
|
||||
{- A key's checksum is checked during fsck. -}
|
||||
checkKeyChecksum :: SHASize -> Key -> Annex Bool
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue