diff options
Diffstat (limited to 'ishtar_common/utils.py')
-rw-r--r-- | ishtar_common/utils.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/ishtar_common/utils.py b/ishtar_common/utils.py index 3e05ff6eb..1d44026e0 100644 --- a/ishtar_common/utils.py +++ b/ishtar_common/utils.py @@ -1032,9 +1032,11 @@ def rename_and_simplify_media_name(full_path_name, rename=True): :return: new full path name (or old if not changed), modified """ try: + is_str = False exists = os.path.exists(full_path_name) is_file = os.path.isfile(full_path_name) except UnicodeEncodeError: + is_str = True full_path_name = full_path_name.encode('utf-8') exists = os.path.exists(full_path_name) is_file = os.path.isfile(full_path_name) @@ -1043,6 +1045,10 @@ def rename_and_simplify_media_name(full_path_name, rename=True): path, current_name, name = simplify_name(full_path_name, check_existing=True) + if is_str: + full_path_name = full_path_name.decode('utf-8') + name = name.decode('utf-8') + path = path.decode('utf-8') if current_name == name: return full_path_name, False |