Pleroma.Upload: dialyzer error

I have opted to set this to :upper as this retains the same behavior but clears up the error.

lib/pleroma/upload.ex:178:call
The function call will not succeed.

Base.encode16(binary(), [{:lower, true}])

breaks the contract
(binary(), [{:case, encode_case()}]) :: binary()
This commit is contained in:
Mark Felder 2024-01-26 19:09:38 -05:00
parent 06b8923d42
commit 87cf7010fc

View File

@ -175,7 +175,7 @@ defmodule Pleroma.Upload do
defp prepare_upload(%{img: "data:image/" <> image_data}, opts) do
parsed = Regex.named_captures(~r/(?<filetype>jpeg|png|gif);base64,(?<data>.*)/, image_data)
data = Base.decode64!(parsed["data"], ignore: :whitespace)
hash = Base.encode16(:crypto.hash(:sha256, data), lower: true)
hash = Base.encode16(:crypto.hash(:sha256, data), case: :upper)
with :ok <- check_binary_size(data, opts.size_limit),
tmp_path <- tempfile_for_image(data),