avatars: Clean up now-irrelevant assumptions.

This x=x hack was removed in 3bd3173b1f.
This commit is contained in:
Alex Vandiver 2024-06-13 19:23:51 +00:00 committed by Tim Abbott
parent fb929ca218
commit 41d1b417e7
2 changed files with 6 additions and 8 deletions

View File

@ -285,9 +285,10 @@ def serve_local_avatar_unauthed(request: HttpRequest, path: str) -> HttpResponse
# We do not expect clients to hit this URL when using the S3
# backend; however, there is no reason to not serve the
# redirect to S3 where the content lives.
return redirect(
get_public_upload_root_url() + path + "?" + request.GET.urlencode(), permanent=True
)
url = get_public_upload_root_url() + path
if request.GET.urlencode():
url += "?" + request.GET.urlencode()
return redirect(url, permanent=True)
local_path = os.path.join(settings.LOCAL_AVATARS_DIR, path)
assert_is_local_storage_path("avatars", local_path)

View File

@ -312,12 +312,9 @@ def avatar(
avatar_version = 1
url = get_gravatar_url(email, avatar_version, medium)
# We can rely on the URL already having query parameters. Because
# our templates depend on being able to use the ampersand to
# add query parameters to our url, get_avatar_url does '?x=x'
# hacks to prevent us from having to jump through decode/encode hoops.
assert url is not None
url = append_url_query_string(url, request.META["QUERY_STRING"])
if request.META["QUERY_STRING"]:
url = append_url_query_string(url, request.META["QUERY_STRING"])
return redirect(url)