Open
Description
As suggested here: #74316 (comment)
Ideally, when reading a tar.xyz
compressed file using TarFile
or TarArchive
APIs, we should detect the magic numbers at the beginning of the archive, determine the archive is compressed, and throw a friendlier error message. We currently throw Unable to parse number
in ThrowInvalidNumber()
. And we could offer two variations of the same exception:
- If we support the compression algorithm, suggest wrapping the archive with a stream class for that algorithm (DeflateStream, GZipStream, ZLibStream).
- If we don't support the compression algorithm, but it has magic numbers, detect them, mention the algorithm is currently unsupported.
Note: We have proposal #70517 to track the request to be able to open tar.gz
files, since we support gzip. TarFile
and TarArchive
support the tar format only, no compression.