From f8737777b1b6fc8daba6f1ee855ceed6376d3504 Mon Sep 17 00:00:00 2001 From: Calum Lind Date: Fri, 11 Feb 2011 09:48:00 +0000 Subject: [PATCH] Fix #1527 - Converting unicode to unicode error in move_storage --- deluge/core/torrent.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/deluge/core/torrent.py b/deluge/core/torrent.py index a1a2bdd27..21a184e63 100644 --- a/deluge/core/torrent.py +++ b/deluge/core/torrent.py @@ -807,10 +807,15 @@ class Torrent(object): def move_storage(self, dest): """Move a torrent's storage location""" - - # Convert path from utf8 to unicode - dest_u=unicode(dest,"utf-8") - + + # Attempt to convert utf8 path to unicode + # Note: Inconsistent encoding for 'dest', needs future investigation + try: + dest_u = unicode(dest, "utf-8") + except TypeError: + # String is already unicode + dest_u = dest + if not os.path.exists(dest_u): try: # Try to make the destination path if it doesn't exist