yjh0502 / erl-brotli

Brotli encoder NIF for Erlang
Other
29 stars 17 forks source link

Error occuring on decode #21

Open riebeekn opened 1 month ago

riebeekn commented 1 month ago

Hello, thanks for the library! I am not using it directly but via Req.

I am running into an issue where it looks like an error occurs when attempting to decode a valid br file.

For example, if I do the following from the console:

curl -H "Accept-Encoding: br" "https://thegreathall.ca/calendar/" -o calendar.br
brotli --decompress calendar.br -o calendar.html

The file is decoded without issue.

If I try the same from an Elixir app, I am seeing an :error atom returning, i.e.

f = File.read!("calendar.br")
:brotli.decode(f)

Could totally be something I am doing / misunderstanding, but my understanding is :brotle.decode is equivalent to the command line brotli decompress command?

yjh0502 commented 1 month ago

I’ve reproduced the issue and identified the point where the library breaks. I’ll work on a fix over the weekend. Thanks for reporting it!