﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
23759	Storage.get_available_name should preserve all file extensions, not just the first one	thenewguy	Adam Zapletal	"`get_available_name` only preserves the first file extension.  If the file is `foo.tar.gz` then `get_available_name` will return `foo.tar_RANDOM.gz` instead of `foo_RANDOM.tar.gz`

https://github.com/django/django/blob/master/django/core/files/storage.py#L71


{{{
    def get_available_name(self, name):
        """"""
        Returns a filename that's free on the target storage system, and
        available for new content to be written to.
        """"""
        dir_name, file_name = os.path.split(name)
        file_root, file_ext = os.path.splitext(file_name)
        # If the filename already exists, add an underscore and a random 7
        # character alphanumeric string (before the file extension, if one
        # exists) to the filename until the generated filename doesn't exist.
        while self.exists(name):
            # file_ext includes the dot.
            name = os.path.join(dir_name, ""%s_%s%s"" % (file_root, get_random_string(7), file_ext))

        return name
}}}
"	New feature	closed	File uploads/storage	dev	Normal	fixed			Ready for checkin	1	0	0	0	0	0
