logo

pleroma

My custom branche(s) on git.pleroma.social/pleroma/pleroma git clone https://hacktivis.me/git/pleroma.git
commit: 87cf7010fc865f37f518d51e9b41e91cb0524bbe
parent 06b8923d4222b617aeeffd507aa2bf7aa5943de1
Author: Mark Felder <feld@feld.me>
Date:   Fri, 26 Jan 2024 19:09:38 -0500

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()

Diffstat:

Mlib/pleroma/upload.ex2+-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/pleroma/upload.ex b/lib/pleroma/upload.ex @@ -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),