deal with unicode errors for symlinks in same way as for regular files, fixes #382

This commit is contained in:
Thomas Waldmann 2015-11-08 01:05:55 +01:00
parent ba67b96434
commit 5595d56ecf
1 changed files with 4 additions and 1 deletions

View File

@ -342,7 +342,10 @@ Number of files: {0.stats.nfiles}'''.format(self)
source = item[b'source']
if os.path.exists(path):
os.unlink(path)
try:
os.symlink(source, path)
except UnicodeEncodeError:
raise self.IncompatibleFilesystemEncodingError(source, sys.getfilesystemencoding())
self.restore_attrs(path, item, symlink=True)
elif stat.S_ISFIFO(mode):
if not os.path.exists(os.path.dirname(path)):