summaryrefslogtreecommitdiff
path: root/Types/MetaData.hs
diff options
context:
space:
mode:
authorJoey Hess <joeyh@joeyh.name>2019-02-20 14:22:31 -0400
committerJoey Hess <joeyh@joeyh.name>2019-02-20 14:26:18 -0400
commitd839c2110a78ce009ac86e8aeeff3d784c582661 (patch)
tree9526d13e8bbe93db5a7dad3d618c5a9957deb325 /Types/MetaData.hs
parent1a29d64bec654f9070d424f42ade6830b263b948 (diff)
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.
Diffstat (limited to 'Types/MetaData.hs')
-rw-r--r--Types/MetaData.hs2
1 files changed, 1 insertions, 1 deletions
diff --git a/Types/MetaData.hs b/Types/MetaData.hs
index 1e30a44429..6ee60b3e2d 100644
--- a/Types/MetaData.hs
+++ b/Types/MetaData.hs
@@ -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