Process the blocks that hold a GNU longname or longlink member.
(self, tarfile)
| 1414 | return self |
| 1415 | |
| 1416 | def _proc_gnulong(self, tarfile): |
| 1417 | """Process the blocks that hold a GNU longname |
| 1418 | or longlink member. |
| 1419 | """ |
| 1420 | buf = tarfile.fileobj.read(self._block(self.size)) |
| 1421 | |
| 1422 | # Fetch the next header and process it. |
| 1423 | try: |
| 1424 | next = self._fromtarfile(tarfile, dircheck=False) |
| 1425 | except HeaderError as e: |
| 1426 | raise SubsequentHeaderError(str(e)) from None |
| 1427 | |
| 1428 | # Patch the TarInfo object from the next header with |
| 1429 | # the longname information. |
| 1430 | next.offset = self.offset |
| 1431 | if self.type == GNUTYPE_LONGNAME: |
| 1432 | next.name = nts(buf, tarfile.encoding, tarfile.errors) |
| 1433 | elif self.type == GNUTYPE_LONGLINK: |
| 1434 | next.linkname = nts(buf, tarfile.encoding, tarfile.errors) |
| 1435 | |
| 1436 | # Remove redundant slashes from directories. This is to be consistent |
| 1437 | # with frombuf(). |
| 1438 | if next.isdir(): |
| 1439 | next.name = next.name.removesuffix("/") |
| 1440 | |
| 1441 | return next |
| 1442 | |
| 1443 | def _proc_sparse(self, tarfile): |
| 1444 | """Process a GNU sparse header plus extra headers. |
no test coverage detected