From 4119780c0fdde17b90340b6f8c0bb6b68f9c3c59 Mon Sep 17 00:00:00 2001 From: Helmut Grohne Date: Sat, 27 Jan 2024 19:25:55 +0100 Subject: examples/chroottar.py: allow opening non-zstd tars When decompression fails, we should raise a tarfile.ReadError rather than a zstandard.ZstdError. Otherwise, tarfile gives up guessing. --- examples/chroottar.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'examples') diff --git a/examples/chroottar.py b/examples/chroottar.py index 56613de..ed494b2 100755 --- a/examples/chroottar.py +++ b/examples/chroottar.py @@ -38,7 +38,7 @@ class TarFile(tarfile.TarFile): zfobj = zstandard.open(name, "rb") try: tarobj = cls.taropen(name, "r", zfobj) - except (OSError, EOFError) as exc: + except (OSError, EOFError, zstandard.ZstdError) as exc: zfobj.close() raise tarfile.ReadError("not a zst file") from exc except: -- cgit v1.2.3