import: Fix sending floats to boto S3 metadata keys.

The boto library's s3 interface allows setting only string-format
metadata keys.  So we need to cast the last_modified floating-point
timestamp into a string before storing on the S3 object.

This bug mostly broke uploading avatars when using the S3 storage backend.
This commit is contained in:
Tim Abbott
2018-12-29 22:09:31 -08:00
parent e7ef0904f5
commit f0c7424957

View File

@@ -594,7 +594,7 @@ def import_uploads(import_dir: Path, processing_avatars: bool=False,
key.set_metadata("user_profile_id", str(user_profile.id))
if 'last_modified' in record:
key.set_metadata("orig_last_modified", record['last_modified'])
key.set_metadata("orig_last_modified", str(record['last_modified']))
key.set_metadata("realm_id", str(record['realm_id']))
# Zulip exports will always have a content-type, but third-party exports might not.