more OsPath conversion

Sponsored-by: Luke T. Shumaker
This commit is contained in:
Joey Hess 2025-01-28 16:31:19 -04:00
parent 7da6f83582
commit 0376bc5ee0
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
7 changed files with 130 additions and 134 deletions

View file

@ -153,10 +153,10 @@ instance Proto.Serializable TransferAssociatedFile where
-- Comes last, so whitespace is ok. But, in case the filename
-- contains eg a newline, escape it. Use C-style encoding.
serialize (TransferAssociatedFile (AssociatedFile (Just f))) =
decodeBS (encode_c isUtf8Byte f)
fromRawFilePath (encode_c isUtf8Byte (fromOsPath f))
serialize (TransferAssociatedFile (AssociatedFile Nothing)) = ""
deserialize "" = Just $ TransferAssociatedFile $
AssociatedFile Nothing
deserialize s = Just $ TransferAssociatedFile $
AssociatedFile $ Just $ decode_c $ encodeBS s
AssociatedFile $ Just $ toOsPath $ decode_c $ toRawFilePath s