fix file name for files that already exist

This commit is contained in:
Jack Robison 2018-02-13 15:02:06 -05:00
parent e40d4f74d8
commit a7567361dc
No known key found for this signature in database
GPG key ID: DF25C68FE0239BB2

View file

@ -17,9 +17,7 @@ log = logging.getLogger(__name__)
def _get_next_available_file_name(download_directory, file_name):
base_name, ext = os.path.splitext(file_name or "_")
if ext:
ext = ".%s" % ext
base_name, ext = os.path.splitext(file_name)
i = 0
while os.path.isfile(os.path.join(download_directory, file_name)):
i += 1