import tarfile
import pathlib


def _strip_paths(tarinfo: tarfile.TarInfo) -> tarfile.TarInfo:
    """Ensure source filesystem absolute paths are not reflected in tar file."""
    original_path = pathlib.Path(tarinfo.name)
    tarinfo.name = f"{original_path.name}"

    return tarinfo