Browse Source

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

Thomas Waldmann 9 years ago
parent
commit
5595d56ecf
1 changed files with 4 additions and 1 deletions
  1. 4 1
      borg/archive.py

+ 4 - 1
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)):