1. tghw
  2. django-storages

Commits

David Larlet  committed a9ccf71

Image: Use os.path.splitext in image storage rather than custom code. Thanks Michael Elsdörfer.

  • Participants
  • Parent commits 6f08ab4
  • Branches default

Comments (0)

Files changed (1)

File backends/image.py

View file
  • Ignore whitespace
         
         # Does the basename already have an extension? If so, replace it.
         # bare as in without extension
-        bare_basename = basename if '.' not in basename else basename[:basename.rindex('.')]
+        bare_basename, _ = os.path.splitext(basename)
         basename = bare_basename + '.' + extension
         
         name = os.path.join(dirname, basename)