Skip to content

Commit

Permalink
Device sync: Use defensive encoding (bug 1097)
Browse files Browse the repository at this point in the history
Make sure that we always use the system default
encoding for file and folder names in order to
avoid encoding errors on certain systems.
  • Loading branch information
thp committed Aug 23, 2010
1 parent 231c31c commit 060ba86
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/gpodder/sync.py
Expand Up @@ -558,6 +558,8 @@ def add_track(self, episode):
else:
folder = self.destination

folder = util.sanitize_encoding(folder)

from_file = util.sanitize_encoding(self.convert_track(episode))
filename_base = util.sanitize_filename(episode.sync_filename(self._config.custom_sync_name_enabled, self._config.custom_sync_name), self._config.mp3_player_max_filename_length)

Expand All @@ -569,7 +571,7 @@ def add_track(self, episode):
if os.path.splitext(to_file)[0] == '':
to_file = os.path.basename(from_file)

to_file = os.path.join(folder, to_file)
to_file = util.sanitize_encoding(os.path.join(folder, to_file))

if not os.path.exists(folder):
try:
Expand Down

0 comments on commit 060ba86

Please sign in to comment.