diff options
| -rw-r--r-- | ishtar_common/utils.py | 16 | 
1 files changed, 8 insertions, 8 deletions
| diff --git a/ishtar_common/utils.py b/ishtar_common/utils.py index e6bc38237..3e05ff6eb 100644 --- a/ishtar_common/utils.py +++ b/ishtar_common/utils.py @@ -1001,12 +1001,12 @@ def simplify_name(full_path_name, check_existing=False):      name = name_exp[-1]      current_name = name[:]      ext = "" -    if u"." in name:  # remove extension if have one -        names = name.split(u".") -        name = u".".join(names[0:-1]) -        ext = u"." + names[-1] +    if "." in name:  # remove extension if have one +        names = name.split(".") +        name = ".".join(names[0:-1]) +        ext = "." + names[-1] -    while u"_" in name and len(name) > 15: +    while "_" in name and len(name) > 15:          oldname = name[:]          for regex in MEDIA_RE:              match = None @@ -1214,11 +1214,11 @@ def try_fix_file(filename, make_copy=True):          filename, check_existing=False)      try: -        dirs = list(os.listdir(path)) +        dirs = list(sorted(os.listdir(path)))      except UnicodeDecodeError: -        dirs = list(os.listdir(path.encode('utf-8'))) +        dirs = list(sorted(os.listdir(path.encode('utf-8'))))      # check existing files in the path -    for file in sorted(dirs): +    for file in dirs:          full_file = os.sep.join([path, file])          if not os.path.isfile(full_file):  # must be a file              continue | 
