Skip to content
Snippets Groups Projects
Unverified Commit 3eb7b4e1 authored by Ned Batchelder's avatar Ned Batchelder Committed by GitHub
Browse files

Merge pull request #24395 from fghaas/fix_profile_images_on_s3

Fix profile image URLs for image storage on non-public S3 buckets
parents 6ed0f969 26281cbe
No related branches found
No related tags found
No related merge requests found
......@@ -55,7 +55,12 @@ def _get_profile_image_urls(name, storage, file_extension=PROFILE_IMAGE_FILE_EXT
url = storage.url(
_get_profile_image_filename(name, size, file_extension=file_extension)
)
return '{}?v={}'.format(url, version) if version is not None else url
# Return the URL, with the "v" parameter added as its query
# string with "?v=". If the original URL already includes a
# query string (such as signed S3 URLs), append to the query
# string with "&v=" instead.
separator = '&' if '?' in url else '?'
return '{}{}v={}'.format(url, separator, version) if version is not None else url
return {size_display_name: _make_url(size) for size_display_name, size in settings.PROFILE_IMAGE_SIZES_MAP.items()}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment