summaryrefslogtreecommitdiff
path: root/Types/MetaData.hs
diff options
context:
space:
mode:
authorJoey Hess <joeyh@joeyh.name>2023-10-26 12:42:32 -0400
committerJoey Hess <joeyh@joeyh.name>2023-10-26 13:10:05 -0400
commit3742263c99180d1391e4fd51724aae52d6d02137 (patch)
treea0d773a3a2a28ecbeb68ec69c85e6db06a717f1d /Types/MetaData.hs
parent985dd38847452d522b9eac84b3331ded3d17df8e (diff)
simplify base64 to only use ByteString
Note the use of fromString and toString from Data.ByteString.UTF8 dated back to commit 9b93278e8abe1163d53fbf56909d0fe6d7de69e9. Back then it was using the dataenc package for base64, which operated on Word8 and String. But with the switch to sandi, it uses ByteString, and indeed fromB64' and toB64' were already using ByteString without that complication. So I think there is no risk of such an encoding related breakage. I also tested the case that 9b93278e8abe1163d53fbf56909d0fe6d7de69e9 fixed: git-annex metadata -s foo='a …' x git-annex metadata x metadata x foo=a … In Remote.Helper.Encryptable, it was avoiding using Utility.Base64 because of that UTF8 conversion. Since that's no longer done, it can just use it now.
Diffstat (limited to 'Types/MetaData.hs')
-rw-r--r--Types/MetaData.hs4
1 files changed, 2 insertions, 2 deletions
diff --git a/Types/MetaData.hs b/Types/MetaData.hs
index 7df07a87eb..316c06a2f7 100644
--- a/Types/MetaData.hs
+++ b/Types/MetaData.hs
@@ -137,14 +137,14 @@ instance MetaSerializable MetaValue where
serialize (MetaValue isset v) =
serialize isset <>
if B8.any (`elem` [' ', '\r', '\n']) v || "!" `B8.isPrefixOf` v
- then "!" <> toB64' v
+ then "!" <> toB64 v
else v
deserialize b = do
(isset, b') <- B8.uncons b
case B8.uncons b' of
Just ('!', b'') -> MetaValue
<$> deserialize (B8.singleton isset)
- <*> fromB64Maybe' b''
+ <*> fromB64Maybe b''
_ -> MetaValue
<$> deserialize (B8.singleton isset)
<*> pure b'