##// END OF EJS Templates
archival: fsdecode paths before passing to tar or zip objects...
Augie Fackler -
r36724:bfe23afe default
parent child Browse files
Show More
@@ -21,6 +21,7 b' from . import ('
21 21 error,
22 22 formatter,
23 23 match as matchmod,
24 pycompat,
24 25 scmutil,
25 26 util,
26 27 vfs as vfsmod,
@@ -171,13 +172,14 b' class tarit(object):'
171 172 self.z = taropen('w|', fileobj=dest)
172 173
173 174 def addfile(self, name, mode, islink, data):
175 name = pycompat.fsdecode(name)
174 176 i = tarfile.TarInfo(name)
175 177 i.mtime = self.mtime
176 178 i.size = len(data)
177 179 if islink:
178 180 i.type = tarfile.SYMTYPE
179 181 i.mode = 0o777
180 i.linkname = data
182 i.linkname = pycompat.fsdecode(data)
181 183 data = None
182 184 i.size = 0
183 185 else:
@@ -218,7 +220,7 b' class zipit(object):'
218 220 dest.tell()
219 221 except (AttributeError, IOError):
220 222 dest = tellable(dest)
221 self.z = zipfile.ZipFile(dest, r'w',
223 self.z = zipfile.ZipFile(pycompat.fsdecode(dest), r'w',
222 224 compress and zipfile.ZIP_DEFLATED or
223 225 zipfile.ZIP_STORED)
224 226
@@ -232,7 +234,7 b' class zipit(object):'
232 234 self.date_time = time.gmtime(mtime)[:6]
233 235
234 236 def addfile(self, name, mode, islink, data):
235 i = zipfile.ZipInfo(name, self.date_time)
237 i = zipfile.ZipInfo(pycompat.fsdecode(name), self.date_time)
236 238 i.compress_type = self.z.compression
237 239 # unzip will not honor unix file modes unless file creator is
238 240 # set to unix (id 3).
General Comments 0
You need to be logged in to leave comments. Login now