Commits

Michael Elsdörfer committed 80c9bf1

Use os.path.splitext in image storage rather than custom code.

Comments (0)

Files changed (1)

django_storages/image.py

         extension = self.find_extension(im.format)
 
         # 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)