Process the blocks that hold a GNU longname or longlink member.
(self, tarfile)
| 1342 | return self |
| 1343 | |
| 1344 | def _proc_gnulong(self, tarfile): |
| 1345 | """Process the blocks that hold a GNU longname |
| 1346 | or longlink member. |
| 1347 | """ |
| 1348 | buf = tarfile.fileobj.read(self._block(self.size)) |
| 1349 | |
| 1350 | # Fetch the next header and process it. |
| 1351 | try: |
| 1352 | next = self.fromtarfile(tarfile) |
| 1353 | except HeaderError as e: |
| 1354 | raise SubsequentHeaderError(str(e)) from None |
| 1355 | |
| 1356 | # Patch the TarInfo object from the next header with |
| 1357 | # the longname information. |
| 1358 | next.offset = self.offset |
| 1359 | if self.type == GNUTYPE_LONGNAME: |
| 1360 | next.name = nts(buf, tarfile.encoding, tarfile.errors) |
| 1361 | elif self.type == GNUTYPE_LONGLINK: |
| 1362 | next.linkname = nts(buf, tarfile.encoding, tarfile.errors) |
| 1363 | |
| 1364 | # Remove redundant slashes from directories. This is to be consistent |
| 1365 | # with frombuf(). |
| 1366 | if next.isdir(): |
| 1367 | next.name = next.name.removesuffix("/") |
| 1368 | |
| 1369 | return next |
| 1370 | |
| 1371 | def _proc_sparse(self, tarfile): |
| 1372 | """Process a GNU sparse header plus extra headers. |
no test coverage detected