Skip to content

Commit 8e12c77

Browse files
authored
Merge pull request #4529 from unisonweb/runarorama/fixNatToHex
Fix bug in `Bytes.fromBase16` when chunks have an odd size
2 parents 5e98e80 + a14d683 commit 8e12c77

File tree

1 file changed

+1
-7
lines changed
  • lib/unison-util-bytes/src/Unison/Util

1 file changed

+1
-7
lines changed

lib/unison-util-bytes/src/Unison/Util/Bytes.hs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -370,13 +370,7 @@ arrayToChunk bs = case BA.convert bs :: Block Word8 of
370370
chunkFromArray = arrayToChunk
371371

372372
fromBase16 :: Bytes -> Either Text.Text Bytes
373-
fromBase16 bs = case traverse convert (chunks bs) of
374-
Left e -> Left (Text.pack e)
375-
Right bs -> Right (fromChunks bs)
376-
where
377-
convert b =
378-
BE.convertFromBase BE.Base16 (chunkToArray @BA.Bytes b)
379-
<&> arrayToChunk @BA.Bytes
373+
fromBase16 = fromBase BE.Base16
380374

381375
toBase32, toBase64, toBase64UrlUnpadded :: Bytes -> Bytes
382376
toBase32 = toBase BE.Base32

0 commit comments

Comments
 (0)