mirror of https://github.com/zulip/zulip.git
zerver/lib/upload.py: Sweep force_bytes from ensure_medium_avatar_image.
This commit is contained in:
parent
092472f42d
commit
cc872ad976
|
@ -11,7 +11,7 @@ import unicodedata
|
||||||
|
|
||||||
from zerver.lib.avatar_hash import user_avatar_path
|
from zerver.lib.avatar_hash import user_avatar_path
|
||||||
from zerver.lib.exceptions import JsonableError, ErrorCode
|
from zerver.lib.exceptions import JsonableError, ErrorCode
|
||||||
from zerver.lib.str_utils import NonBinaryStr, force_bytes
|
from zerver.lib.str_utils import NonBinaryStr
|
||||||
|
|
||||||
from boto.s3.bucket import Bucket
|
from boto.s3.bucket import Bucket
|
||||||
from boto.s3.key import Key
|
from boto.s3.key import Key
|
||||||
|
@ -355,9 +355,9 @@ class S3UploadBackend(ZulipUploadBackend):
|
||||||
conn = S3Connection(settings.S3_KEY, settings.S3_SECRET_KEY)
|
conn = S3Connection(settings.S3_KEY, settings.S3_SECRET_KEY)
|
||||||
bucket = get_bucket(conn, bucket_name)
|
bucket = get_bucket(conn, bucket_name)
|
||||||
key = bucket.get_key(file_path)
|
key = bucket.get_key(file_path)
|
||||||
image_data = force_bytes(key.get_contents_as_string())
|
image_data = key.get_contents_as_string()
|
||||||
|
|
||||||
resized_medium = resize_avatar(image_data, MEDIUM_AVATAR_SIZE)
|
resized_medium = resize_avatar(image_data, MEDIUM_AVATAR_SIZE) # type: ignore # image_data is `bytes`, boto subs are wrong
|
||||||
upload_image_to_s3(
|
upload_image_to_s3(
|
||||||
bucket_name,
|
bucket_name,
|
||||||
s3_file_name + "-medium.png",
|
s3_file_name + "-medium.png",
|
||||||
|
|
Loading…
Reference in New Issue