Process the blocks that hold a GNU longname or longlink member.
(self, tarfile)
| 1395 | return self |
| 1396 | |
| 1397 | def _proc_gnulong(self, tarfile): |
| 1398 | """Process the blocks that hold a GNU longname |
| 1399 | or longlink member. |
| 1400 | """ |
| 1401 | buf = tarfile.fileobj.read(self._block(self.size)) |
| 1402 | |
| 1403 | # Fetch the next header and process it. |
| 1404 | try: |
| 1405 | next = self.fromtarfile(tarfile) |
| 1406 | except HeaderError as e: |
| 1407 | raise SubsequentHeaderError(str(e)) from None |
| 1408 | |
| 1409 | # Patch the TarInfo object from the next header with |
| 1410 | # the longname information. |
| 1411 | next.offset = self.offset |
| 1412 | if self.type == GNUTYPE_LONGNAME: |
| 1413 | next.name = nts(buf, tarfile.encoding, tarfile.errors) |
| 1414 | elif self.type == GNUTYPE_LONGLINK: |
| 1415 | next.linkname = nts(buf, tarfile.encoding, tarfile.errors) |
| 1416 | |
| 1417 | # Remove redundant slashes from directories. This is to be consistent |
| 1418 | # with frombuf(). |
| 1419 | if next.isdir(): |
| 1420 | next.name = next.name.removesuffix("/") |
| 1421 | |
| 1422 | return next |
| 1423 | |
| 1424 | def _proc_sparse(self, tarfile): |
| 1425 | """Process a GNU sparse header plus extra headers. |
no test coverage detected