fix build with text older than 2.0

This commit is contained in:
Joey Hess 2024-07-29 18:15:29 -04:00
parent e73bbdd95c
commit acb436b999
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38

View file

@ -151,7 +151,11 @@ data Auth = Auth B.ByteString B.ByteString
instance ToHttpApiData Auth where
toHeader (Auth u p) = "Basic " <> B64.encode (u <> ":" <> p)
#if MIN_VERSION_text(2,0,0)
toUrlPiece = TE.decodeUtf8Lenient . toHeader
#else
toUrlPiece = TE.decodeUtf8With (\_ _ -> Just '\xfffd') . toHeader
#endif
instance FromHttpApiData Auth where
parseHeader h =