Fetch count before downloading the pack and use that as page size
This commit is contained in:
parent
69e4ebbb8e
commit
29158681f9
|
@ -0,0 +1 @@
|
||||||
|
When downloading remote emojis packs, account for pagination
|
|
@ -251,8 +251,12 @@ def download(name, url, as) do
|
||||||
uri = url |> String.trim() |> URI.parse()
|
uri = url |> String.trim() |> URI.parse()
|
||||||
|
|
||||||
with :ok <- validate_shareable_packs_available(uri),
|
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} <-
|
{: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, %{sha: sha, url: url} = pack_info} <- fetch_pack_info(remote_pack, uri, name),
|
||||||
{:ok, archive} <- download_archive(url, sha),
|
{:ok, archive} <- download_archive(url, sha),
|
||||||
pack <- copy_as(remote_pack, as || name),
|
pack <- copy_as(remote_pack, as || name),
|
||||||
|
|
Loading…
Reference in New Issue