[Git][haskell-team/DHG_packages][master] pandoc-server: Switch from base64 to base64-bytestring

Ilias Tsitsimpis (@iliastsi) gitlab at salsa.debian.org
Wed Dec 6 17:23:44 GMT 2023



Ilias Tsitsimpis pushed to branch master at Debian Haskell Group / DHG_packages


Commits:
b93d4a5f by Ilias Tsitsimpis at 2023-12-06T19:20:27+02:00
pandoc-server: Switch from base64 to base64-bytestring

- - - - -


4 changed files:

- p/haskell-pandoc-server/debian/changelog
- p/haskell-pandoc-server/debian/control
- + p/haskell-pandoc-server/debian/patches/replace-base64
- + p/haskell-pandoc-server/debian/patches/series


Changes:

=====================================
p/haskell-pandoc-server/debian/changelog
=====================================
@@ -1,3 +1,9 @@
+haskell-pandoc-server (0.1.0.2-3) unstable; urgency=medium
+
+  * Switch from base64 to base64-bytestring
+
+ -- Ilias Tsitsimpis <iliastsi at debian.org>  Wed, 06 Dec 2023 19:19:02 +0200
+
 haskell-pandoc-server (0.1.0.2-2) unstable; urgency=medium
 
   * Sourceful upload (post-NEW)


=====================================
p/haskell-pandoc-server/debian/control
=====================================
@@ -12,9 +12,9 @@ Build-Depends: debhelper (>= 10),
  libghc-aeson-dev (>= 2.0),
  libghc-aeson-dev (<< 2.3),
  libghc-aeson-prof,
- libghc-base64-dev (>= 0.4),
- libghc-base64-dev (<< 0.5),
- libghc-base64-prof,
+ libghc-base64-bytestring-dev (>= 0.1),
+ libghc-base64-bytestring-dev (<< 1.3),
+ libghc-base64-bytestring-prof,
  libghc-data-default-dev (>= 0.4),
  libghc-data-default-dev (<< 0.8),
  libghc-data-default-prof,
@@ -43,7 +43,7 @@ Build-Depends: debhelper (>= 10),
  libghc-wai-cors-prof,
 Build-Depends-Indep: ghc-doc,
  libghc-aeson-doc,
- libghc-base64-doc,
+ libghc-base64-bytestring-doc,
  libghc-data-default-doc,
  libghc-doctemplates-doc,
  libghc-pandoc-doc,


=====================================
p/haskell-pandoc-server/debian/patches/replace-base64
=====================================
@@ -0,0 +1,90 @@
+From e7348b4f769eb79973cdf52b11ec2a89bbca4a7f Mon Sep 17 00:00:00 2001
+From: John MacFarlane <jgm at berkeley.edu>
+Date: Wed, 6 Dec 2023 09:11:07 -0800
+Subject: [PATCH] pandoc-server: Switch from base64 to base64-bytestring.
+
+See #9233.
+---
+ pandoc-server/pandoc-server.cabal       |  2 +-
+ pandoc-server/src/Text/Pandoc/Server.hs | 25 ++++++++++---------------
+ 2 files changed, 11 insertions(+), 16 deletions(-)
+
+Index: b/pandoc-server.cabal
+===================================================================
+--- a/pandoc-server.cabal
++++ b/pandoc-server.cabal
+@@ -54,7 +54,7 @@ library
+                  containers            >= 0.6.0.1  && < 0.7,
+                  aeson                 >= 2.0      && < 2.3,
+                  bytestring            >= 0.9      && < 0.13,
+-                 base64                >= 0.4      && < 0.5,
++                 base64-bytestring     >= 0.1      && < 1.3,
+                  doctemplates          >= 0.11     && < 0.12,
+                  data-default          >= 0.4      && < 0.8,
+                  text                  >= 1.1.1.0  && < 2.1,
+Index: b/src/Text/Pandoc/Server.hs
+===================================================================
+--- a/src/Text/Pandoc/Server.hs
++++ b/src/Text/Pandoc/Server.hs
+@@ -29,7 +29,7 @@ import qualified Data.Text.Lazy.Encoding
+ import Data.Maybe (fromMaybe)
+ import qualified Data.ByteString as BS
+ import qualified Data.ByteString.Lazy as BL
+-import Data.ByteString.Base64 (decodeBase64, encodeBase64)
++import qualified Data.ByteString.Base64 as Base64 (decodeLenient, encode)
+ import Data.Default
+ import Control.Monad (when, unless, foldM)
+ import qualified Data.Set as Set
+@@ -111,15 +111,11 @@ newtype Blob = Blob BL.ByteString
+   deriving (Show, Eq)
+ 
+ instance ToJSON Blob where
+-  toJSON (Blob bs) = toJSON (encodeBase64 $ BL.toStrict bs)
++  toJSON (Blob bs) = toJSON (UTF8.toText . Base64.encode $ BL.toStrict bs)
+ 
+ instance FromJSON Blob where
+- parseJSON = withText "Blob" $ \t -> do
+-   let inp = UTF8.fromText t
+-   case decodeBase64 inp of
+-        Right bs -> return $ Blob $ BL.fromStrict bs
+-        Left _ -> -- treat as regular text
+-                    return $ Blob $ BL.fromStrict inp
++ parseJSON = withText "Blob" $
++   pure . Blob . BL.fromStrict . Base64.decodeLenient . UTF8.fromText
+ 
+ -- This is the data to be supplied by the JSON payload
+ -- of requests.  Maybe values may be omitted and will be
+@@ -236,7 +232,8 @@ server = convertBytes
+   --    handleErr =<< liftIO (runIO (convert' params))
+   -- will allow the IO operations.
+   convertText params = handleErr $
+-    runPure (convert' return (return . encodeBase64 . BL.toStrict) params)
++    runPure (convert' return (return . UTF8.toText .
++                               Base64.encode . BL.toStrict) params)
+ 
+   convertBytes params = handleErr $
+     runPure (convert' (return . UTF8.fromText) (return . BL.toStrict) params)
+@@ -245,7 +242,7 @@ server = convertBytes
+     runPure
+       (convert'
+         (\t -> Succeeded t False . map toMessage <$> getLog)
+-        (\bs -> Succeeded (encodeBase64 (BL.toStrict bs)) True
++        (\bs -> Succeeded (UTF8.toText $ Base64.encode (BL.toStrict bs)) True
+                  . map toMessage <$> getLog)
+         params)
+ 
+@@ -341,11 +338,9 @@ server = convertBytes
+ 
+     let reader = case readerSpec of
+                 TextReader r -> r readeropts
+-                ByteStringReader r -> \t -> do
+-                  let eitherbs = decodeBase64 $ UTF8.fromText t
+-                  case eitherbs of
+-                    Left errt -> throwError $ PandocSomeError errt
+-                    Right bs -> r readeropts $ BL.fromStrict bs
++                ByteStringReader r ->
++                  r readeropts . BL.fromStrict . Base64.decodeLenient
++                    . UTF8.fromText
+ 
+     let writer d@(Pandoc meta _) = do
+           case lookupMetaString "lang" meta of


=====================================
p/haskell-pandoc-server/debian/patches/series
=====================================
@@ -0,0 +1 @@
+replace-base64



View it on GitLab: https://salsa.debian.org/haskell-team/DHG_packages/-/commit/b93d4a5fd9b3f1e5da78ebad04b9fdfea56977a2

-- 
View it on GitLab: https://salsa.debian.org/haskell-team/DHG_packages/-/commit/b93d4a5fd9b3f1e5da78ebad04b9fdfea56977a2
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-haskell-commits/attachments/20231206/4fec43c9/attachment-0001.htm>


More information about the Pkg-haskell-commits mailing list