Projet

Général

Profil

0002-misc-give-profile-images-a-.jpeg-extension-27645.patch

Frédéric Péters, 29 octobre 2018 15:56

Télécharger (1,55 ko)

Voir les différences:

Subject: [PATCH 2/3] misc: give profile images a .jpeg extension (#27645)

This makes sure nginx will serve them with a correct MIME type.
 src/authentic2/attribute_kinds.py | 2 +-
 tests/test_attribute_kinds.py     | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)
src/authentic2/attribute_kinds.py
125 125
        h_computation.update(chunk)
126 126
    hexdigest = h_computation.hexdigest()
127 127
    stored_file = default_storage.save(
128
        os.path.join('profile-image', hexdigest),
128
        os.path.join('profile-image', hexdigest + '.jpeg'),
129 129
        uploadedfile)
130 130
    return stored_file
131 131

  
tests/test_attribute_kinds.py
411 411
    response = form.submit()
412 412
    assert john().attributes.cityscape_image
413 413
    profile_filename = john().attributes.cityscape_image.name
414
    assert profile_filename.endswith('.jpeg')
414 415

  
415 416
    # verify API serves absolute URL for profile images
416 417
    app.authorization = ('Basic', (admin.username, admin.username))
417
-