Skip to content

Commit a939670

Browse files
toacoraveit65
authored andcommitted
fixed 'exclude command raise UnicodeDecodeError'
origin commit: dropbox/nautilus-dropbox@bd8caf8 dropbox/nautilus-dropbox#28
1 parent 5543711 commit a939670

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

caja-dropbox.in

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -100,14 +100,15 @@ def relpath(path, start=curdir):
100100
if not path:
101101
raise ValueError("no path specified")
102102

103-
if type(start) is unicode:
104-
start_list = unicode_abspath(start).split(sep)
105-
else:
106-
start_list = abspath(start).split(sep)
107-
108103
if type(path) is unicode:
104+
if isinstance(start,str):
105+
start = start.decode(sys.getfilesystemencoding())
106+
start_list = unicode_abspath(start).split(sep)
109107
path_list = unicode_abspath(path).split(sep)
110108
else:
109+
if isinstance(start,unicode):
110+
start = start.encode(sys.getfilesystemencoding())
111+
start_list = abspath(start).split(sep)
111112
path_list = abspath(path).split(sep)
112113

113114
# Work out how much of the filepath is shared by start and path.

0 commit comments

Comments
 (0)