From 5595d56ecf26678e36dca4ec6e7c128c7ab7325d Mon Sep 17 00:00:00 2001 From: Thomas Waldmann Date: Sun, 8 Nov 2015 01:05:55 +0100 Subject: [PATCH] deal with unicode errors for symlinks in same way as for regular files, fixes #382 --- borg/archive.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/borg/archive.py b/borg/archive.py index 524c2a5a1..7edd4162a 100644 --- a/borg/archive.py +++ b/borg/archive.py @@ -342,7 +342,10 @@ Number of files: {0.stats.nfiles}'''.format(self) source = item[b'source'] if os.path.exists(path): os.unlink(path) - os.symlink(source, 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)):