misc: give profile images a .jpeg extension (#27645)

This makes sure nginx will serve them with a correct MIME type.
This commit is contained in:
Frédéric Péters 2018-10-29 15:35:38 +01:00
parent 90ff2d46ab
commit ace8072025
2 changed files with 2 additions and 1 deletions

View File

@ -125,7 +125,7 @@ def profile_image_serialize(uploadedfile):
h_computation.update(chunk)
hexdigest = h_computation.hexdigest()
stored_file = default_storage.save(
os.path.join('profile-image', hexdigest),
os.path.join('profile-image', hexdigest + '.jpeg'),
uploadedfile)
return stored_file

View File

@ -411,6 +411,7 @@ def test_profile_image(db, app, admin, mailoutbox, media):
response = form.submit()
assert john().attributes.cityscape_image
profile_filename = john().attributes.cityscape_image.name
assert profile_filename.endswith('.jpeg')
# verify API serves absolute URL for profile images
app.authorization = ('Basic', (admin.username, admin.username))