logo

pleroma

My custom branche(s) on git.pleroma.social/pleroma/pleroma git clone https://hacktivis.me/git/pleroma.git
commit: 29158681f9f6d3f16bcab011a3338a60f11afddc
parent 69e4ebbb8ea5d273c4a82ee8dcc275da8ee1dace
Author: Ekaterina Vaartis <vaartis@kotobank.ch>
Date:   Sun,  7 Jan 2024 17:05:30 +0300

Fetch count before downloading the pack and use that as page size

Diffstat:

Achangelog.d/emoji-download-paginate.fix2++
Mlib/pleroma/emoji/pack.ex6+++++-
2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/changelog.d/emoji-download-paginate.fix b/changelog.d/emoji-download-paginate.fix @@ -0,0 +1 @@ +When downloading remote emojis packs, account for pagination +\ No newline at end of file diff --git a/lib/pleroma/emoji/pack.ex b/lib/pleroma/emoji/pack.ex @@ -251,8 +251,12 @@ defmodule Pleroma.Emoji.Pack do uri = url |> String.trim() |> URI.parse() with :ok <- validate_shareable_packs_available(uri), + {:ok, %{"files_count" => files_count}} <- + uri |> URI.merge("/api/v1/pleroma/emoji/pack?name=#{name}&page_size=0") |> http_get(), {:ok, remote_pack} <- - uri |> URI.merge("/api/v1/pleroma/emoji/pack?name=#{name}") |> http_get(), + uri + |> URI.merge("/api/v1/pleroma/emoji/pack?name=#{name}&page_size=#{files_count}") + |> http_get(), {:ok, %{sha: sha, url: url} = pack_info} <- fetch_pack_info(remote_pack, uri, name), {:ok, archive} <- download_archive(url, sha), pack <- copy_as(remote_pack, as || name),