fix encoding of metadata containing newlines

This fixes a reversion in the ByteString conversion. The old code used
isSpace to decide when the metadata value needs to be base64 encoded,
and that incorrectly changed to only checking if it contained ' '.

Note that only '\n' and '\r' were added and not other sorts of
whitespace that isSpace matches, like '\t' and '\v'. Only the former
would cause problems.
This commit is contained in:
Joey Hess 2019-02-20 14:22:31 -04:00
parent 1a29d64bec
commit d839c2110a
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
2 changed files with 8 additions and 1 deletions

View file

@ -1,3 +1,10 @@
git-annex (7.20190220) UNRELEASED; urgency=medium
* Fix storage of metadata values containing newlines.
(Reversion introduced in version 7.20190122.)
-- Joey Hess <id@joeyh.name> Wed, 20 Feb 2019 14:20:59 -0400
git-annex (7.20190219) upstream; urgency=medium
* init: Fix bug when direct mode needs to be enabled on a crippled

View file

@ -136,7 +136,7 @@ instance MetaSerializable MetaField where
instance MetaSerializable MetaValue where
serialize (MetaValue isset v) =
serialize isset <>
if B8.any (== ' ') v || "!" `B8.isPrefixOf` v
if B8.any (`elem` [' ', '\r', '\n']) v || "!" `B8.isPrefixOf` v
then "!" <> toB64' v
else v
deserialize b = do