Use a case statement in Pathname#compression_type
Handle untarred bzip2 files

Fixes #28187.
Extract common decompression code to a method