credo lint

This commit is contained in:
Phantasm 2025-10-10 22:41:24 +02:00
commit f36851acbd
No known key found for this signature in database
GPG key ID: 2669E588BCC634C8
2 changed files with 7 additions and 5 deletions

View file

@ -220,9 +220,10 @@ defmodule Pleroma.HTTP do
defp query_encode_kv_pair({key, value}, rules \\ []) when is_list(rules) do
cond do
length(rules) > 0 ->
# URI.encode_query/2 does not appear to follow spec and encodes all parts of our URI path Constant.
# This appears to work outside of edge-cases like The Guardian Rich Media Cards,
# keeping behavior same as with URI.encode_query/2 unless otherwise specified via rules.
# URI.encode_query/2 does not appear to follow spec and encodes all part
# of our URI path Constant. This appears to work outside of edge-cases
# like The Guardian Rich Media Cards, keeping behavior same as with
# URI.encode_query/2 unless otherwise specified via rules.
(URI.encode_www_form(Kernel.to_string(key)) <>
"=" <>
URI.encode(value, fn byte ->

View file

@ -101,10 +101,11 @@ defmodule Pleroma.Web.MediaProxy do
end
# The URL coming into MediaProxy from the outside might have wrong %-encoding
# (like older Pleroma versions)
# (like older Pleroma versions).
# This would cause an inconsistency with the encoded URL here and the requested
# URL fixed with Pleroma.Tesla.Middleware.EncodeUrl.
# End result is a failing HEAD request in Pleroma.Web.MediaProxy.MediaProxyController.handle_preview/2
# End result is a failing HEAD request in
# Pleroma.Web.MediaProxy.MediaProxyController.handle_preview/2
def encode_url(url) do
url = HTTP.encode_url(url)
{base64, sig64} = base64_sig64(url)