allenai / cached_path

A file utility for accessing both local and remote files through a unified interface.
https://cached-path.readthedocs.io/
Apache License 2.0
36 stars 12 forks source link

.bin files inside of tar file trigger zipfile extraction which only extracts the contents of the `.bin` file. #208

Closed ksteimel closed 10 months ago

ksteimel commented 10 months ago

Checklist

Description

Python traceback:

``` ```

Related issues or possible duplicates

Environment

OS: MacOS

Python version: 3.10.13

Output of pip freeze:

``` accelerate @ file:///home/conda/feedstock_root/build_artifacts/accelerate_1701450794894/work aiobotocore==2.9.0 aiohttp @ file:///Users/runner/miniforge3/conda-bld/aiohttp_1701099674487/work aiohttp-retry==2.8.3 aioitertools==0.11.0 aiosignal @ file:///home/conda/feedstock_root/build_artifacts/aiosignal_1667935791922/work amqp==5.2.0 annotated-types @ file:///home/conda/feedstock_root/build_artifacts/annotated-types_1696634205638/work antlr4-python3-runtime==4.9.3 anyio @ file:///home/conda/feedstock_root/build_artifacts/anyio_1702909220329/work appdirs @ file:///home/conda/feedstock_root/build_artifacts/appdirs_1603108395799/work archspec @ file:///home/conda/feedstock_root/build_artifacts/archspec_1699370045702/work arrow @ file:///home/conda/feedstock_root/build_artifacts/arrow_1696128962909/work asttokens @ file:///home/conda/feedstock_root/build_artifacts/asttokens_1698341106958/work async-timeout @ file:///home/conda/feedstock_root/build_artifacts/async-timeout_1691763562544/work asyncssh==2.14.2 atpublic==4.0 attrs @ file:///home/conda/feedstock_root/build_artifacts/attrs_1704011227531/work beautifulsoup4 @ file:///home/conda/feedstock_root/build_artifacts/beautifulsoup4_1680888073205/work bert-score @ file:///home/conda/feedstock_root/build_artifacts/bert_score_1618844400749/work billiard==4.2.0 binaryornot==0.4.4 bitsandbytes==0.42.0 blis @ file:///Users/runner/miniforge3/conda-bld/cython-blis_1696148899313/work boltons @ file:///home/conda/feedstock_root/build_artifacts/boltons_1703154663129/work boto3==1.33.13 botocore==1.33.13 Brotli @ file:///Users/runner/miniforge3/conda-bld/brotli-split_1695989934239/work cached_path @ git+https://github.com/allenai/cached_path.git@615b2dd1873536ff7789e40bb1b48ce7e63c8d76 cachetools @ file:///home/conda/feedstock_root/build_artifacts/cachetools_1698197297464/work catalogue @ file:///Users/runner/miniforge3/conda-bld/catalogue_1695626443928/work celery==5.3.6 certifi @ file:///home/conda/feedstock_root/build_artifacts/certifi_1700303426725/work/certifi cffi @ file:///Users/runner/miniforge3/conda-bld/cffi_1696001737800/work cfgv @ file:///home/conda/feedstock_root/build_artifacts/cfgv_1629909281805/work chardet @ file:///Users/runner/miniforge3/conda-bld/chardet_1695468685627/work charset-normalizer @ file:///home/conda/feedstock_root/build_artifacts/charset-normalizer_1698833585322/work click @ file:///home/conda/feedstock_root/build_artifacts/click_1692311806742/work click-didyoumean==0.3.0 click-plugins==1.1.1 click-repl==0.3.0 cloudpathlib @ file:///home/conda/feedstock_root/build_artifacts/cloudpathlib-meta_1697837790453/work colorama @ file:///home/conda/feedstock_root/build_artifacts/colorama_1666700638685/work conda @ file:///Users/runner/miniforge3/conda-bld/conda_1701731166956/work conda-libmamba-solver @ file:///home/conda/feedstock_root/build_artifacts/conda-libmamba-solver_1702406360642/work/src conda-package-handling @ file:///home/conda/feedstock_root/build_artifacts/conda-package-handling_1691048088238/work conda_package_streaming @ file:///home/conda/feedstock_root/build_artifacts/conda-package-streaming_1691009212940/work confection @ file:///Users/runner/miniforge3/conda-bld/confection_1701179345946/work configobj==5.0.8 contourpy @ file:///Users/runner/miniforge3/conda-bld/contourpy_1699041432046/work cookiecutter @ file:///home/conda/feedstock_root/build_artifacts/cookiecutter_1700591923152/work coverage @ file:///Users/runner/miniforge3/conda-bld/coverage_1703727223577/work cryptography @ file:///Users/runner/miniforge3/conda-bld/cryptography-split_1701563310099/work ctparse==0.3.6 curated-tokenizers==0.0.8 curated-transformers==0.1.1 cycler @ file:///home/conda/feedstock_root/build_artifacts/cycler_1696677705766/work cymem @ file:///Users/runner/miniforge3/conda-bld/cymem_1695443580499/work dataclasses @ file:///home/conda/feedstock_root/build_artifacts/dataclasses_1628958434797/work dataclasses-json @ file:///home/conda/feedstock_root/build_artifacts/dataclasses-json_1701152323159/work datasets @ file:///home/conda/feedstock_root/build_artifacts/datasets_1704319050587/work decorator @ file:///home/conda/feedstock_root/build_artifacts/decorator_1641555617451/work dictdiffer==0.9.0 dill @ file:///home/conda/feedstock_root/build_artifacts/dill_1690101045195/work diskcache==5.6.3 distlib @ file:///home/conda/feedstock_root/build_artifacts/distlib_1702383208639/work distro @ file:///home/conda/feedstock_root/build_artifacts/distro_1704321475663/work docker-pycreds==0.4.0 docstring-parser==0.15 dpath==2.1.6 dulwich==0.21.7 dvc==3.38.1 dvc-data==3.7.0 dvc-http==2.32.0 dvc-objects==3.0.3 dvc-render==1.0.0 dvc-s3==3.0.1 dvc-studio-client==0.18.0 dvc-task==0.3.0 en-core-web-sm @ https://github.com/explosion/spacy-models/releases/download/en_core_web_sm-3.7.1/en_core_web_sm-3.7.1-py3-none-any.whl#sha256=86cc141f63942d4b2c5fcee06630fd6f904788d2f0ab005cce45aadb8fb73889 en-core-web-trf @ https://github.com/explosion/spacy-models/releases/download/en_core_web_trf-3.7.3/en_core_web_trf-3.7.3-py3-none-any.whl#sha256=f72abb34bdf174876bd4267b29b2501677e605e0a251fdc56c163003182ed68b entrypoints==0.4 et-xmlfile @ file:///home/conda/feedstock_root/build_artifacts/et_xmlfile_1674664118162/work evaluate @ file:///home/conda/feedstock_root/build_artifacts/evaluate_1697442180934/work exceptiongroup @ file:///home/conda/feedstock_root/build_artifacts/exceptiongroup_1700579780973/work executing @ file:///home/conda/feedstock_root/build_artifacts/executing_1698579936712/work filelock==3.12.4 flatten-dict==0.4.2 flufl.lock==7.1.1 fonttools @ file:///Users/runner/miniforge3/conda-bld/fonttools_1702929764988/work frozenlist @ file:///Users/runner/miniforge3/conda-bld/frozenlist_1702645565720/work fsspec==2023.10.0 funcy==2.0 gitdb @ file:///home/conda/feedstock_root/build_artifacts/gitdb_1697791558612/work GitPython @ file:///home/conda/feedstock_root/build_artifacts/gitpython_1697650329377/work gmpy2 @ file:///Users/runner/miniforge3/conda-bld/gmpy2_1666808753481/work google-api-core @ file:///home/conda/feedstock_root/build_artifacts/google-api-core-split_1702000562495/work google-auth @ file:///home/conda/feedstock_root/build_artifacts/google-auth_1704358690420/work google-cloud-aiplatform @ file:///Users/runner/miniforge3/conda-bld/google-cloud-aiplatform_1704622634070/work google-cloud-bigquery @ file:///home/conda/feedstock_root/build_artifacts/google-cloud-bigquery-split_1702534381503/work google-cloud-core @ file:///home/conda/feedstock_root/build_artifacts/google-cloud-core_1702002980770/work google-cloud-resource-manager @ file:///home/conda/feedstock_root/build_artifacts/google-cloud-resource-manager_1702004765893/work google-cloud-storage @ file:///home/conda/feedstock_root/build_artifacts/google-cloud-storage_1702437105048/work google-crc32c @ file:///Users/runner/miniforge3/conda-bld/google-crc32c_1695545424919/work google-resumable-media @ file:///home/conda/feedstock_root/build_artifacts/google-resumable-media_1702437055406/work googleapis-common-protos @ file:///home/conda/feedstock_root/build_artifacts/googleapis-common-protos-feedstock_1702001866871/work grandalf==0.8 greenlet @ file:///Users/runner/miniforge3/conda-bld/greenlet_1703201682057/work grpc-google-iam-v1 @ file:///home/conda/feedstock_root/build_artifacts/grpc-google-iam-v1_1702004464145/work grpcio @ file:///Users/runner/miniforge3/conda-bld/grpc-split_1700258145304/work grpcio-status @ file:///home/conda/feedstock_root/build_artifacts/grpcio-status_1700331241466/work gto==1.6.1 huggingface-hub==0.19.4 hydra-core==1.3.2 identify @ file:///home/conda/feedstock_root/build_artifacts/identify_1701927326014/work idna @ file:///home/conda/feedstock_root/build_artifacts/idna_1701026962277/work importlib-metadata @ file:///home/conda/feedstock_root/build_artifacts/importlib-metadata_1703269254275/work iniconfig @ file:///home/conda/feedstock_root/build_artifacts/iniconfig_1673103042956/work ipython @ file:///home/conda/feedstock_root/build_artifacts/ipython_1704718870316/work iterative-telemetry==0.0.8 jedi @ file:///home/conda/feedstock_root/build_artifacts/jedi_1696326070614/work Jinja2 @ file:///home/conda/feedstock_root/build_artifacts/jinja2_1654302431367/work jmespath @ file:///home/conda/feedstock_root/build_artifacts/jmespath_1655568249366/work joblib @ file:///home/conda/feedstock_root/build_artifacts/joblib_1691577114857/work jsonlines @ file:///home/conda/feedstock_root/build_artifacts/jsonlines_1693576265121/work jsonpatch @ file:///home/conda/feedstock_root/build_artifacts/jsonpatch_1695536281965/work jsonpointer @ file:///Users/runner/miniforge3/conda-bld/jsonpointer_1695397382064/work kiwisolver @ file:///Users/runner/miniforge3/conda-bld/kiwisolver_1695379982481/work kombu==5.3.4 langchain @ file:///home/conda/feedstock_root/build_artifacts/langchain_1704615457369/work langchain-community @ file:///home/conda/feedstock_root/build_artifacts/langchain-community_1704519404840/work langchain-core @ file:///home/conda/feedstock_root/build_artifacts/langchain-core_1704694519641/work langcodes @ file:///home/conda/feedstock_root/build_artifacts/langcodes_1636741340529/work langsmith @ file:///home/conda/feedstock_root/build_artifacts/langsmith_1704745190741/work lemminflect==0.2.3 libmambapy @ file:///Users/runner/miniforge3/conda-bld/mamba-split_1703178878806/work/libmambapy lmdb @ file:///Users/runner/miniforge3/conda-bld/python-lmdb_1695498021062/work loguru @ file:///Users/runner/miniforge3/conda-bld/loguru_1695547399465/work lxml @ file:///Users/runner/miniforge3/conda-bld/lxml_1704590497751/work mamba @ file:///Users/runner/miniforge3/conda-bld/mamba-split_1703178878806/work/mamba markdown-it-py @ file:///home/conda/feedstock_root/build_artifacts/markdown-it-py_1686175045316/work MarkupSafe @ file:///Users/runner/miniforge3/conda-bld/markupsafe_1695367646585/work marshmallow @ file:///home/conda/feedstock_root/build_artifacts/marshmallow_1689924608696/work matplotlib @ file:///Users/runner/miniforge3/conda-bld/matplotlib-suite_1700509537450/work matplotlib-inline @ file:///home/conda/feedstock_root/build_artifacts/matplotlib-inline_1660814786464/work mdurl @ file:///home/conda/feedstock_root/build_artifacts/mdurl_1704317613764/work menuinst @ file:///Users/runner/miniforge3/conda-bld/menuinst_1702317138933/work mpmath @ file:///home/conda/feedstock_root/build_artifacts/mpmath_1678228039184/work multidict @ file:///Users/runner/miniforge3/conda-bld/multidict_1696716121514/work multiprocess @ file:///Users/runner/miniforge3/conda-bld/multiprocess_1695458915095/work munkres==1.1.4 murmurhash @ file:///Users/runner/miniforge3/conda-bld/murmurhash_1695449903748/work mypy-extensions @ file:///home/conda/feedstock_root/build_artifacts/mypy_extensions_1675543315189/work networkx @ file:///home/conda/feedstock_root/build_artifacts/networkx_1698504735452/work nltk @ file:///home/conda/feedstock_root/build_artifacts/nltk_1672696305909/work nodeenv @ file:///home/conda/feedstock_root/build_artifacts/nodeenv_1683892983968/work numpy @ file:///Users/runner/miniforge3/conda-bld/numpy_1704280780572/work/dist/numpy-1.26.3-cp310-cp310-macosx_11_0_arm64.whl#sha256=f96d0b051b72345dbc317d793b2b34c7c4b7f41b0b791ffc93e820c45ba6a91c omegaconf==2.3.0 openai @ file:///home/conda/feedstock_root/build_artifacts/openai_1695757142572/work openpyxl @ file:///Users/runner/miniforge3/conda-bld/openpyxl_1695464772305/work orjson==3.9.10 packaging @ file:///home/conda/feedstock_root/build_artifacts/packaging_1696202382185/work pandas @ file:///Users/runner/miniforge3/conda-bld/pandas_1702057222502/work pandas-stubs @ file:///home/conda/feedstock_root/build_artifacts/pandas-stubs_1703717707077/work parso @ file:///home/conda/feedstock_root/build_artifacts/parso_1638334955874/work pathspec==0.12.1 pathtools==0.1.2 pathy @ file:///home/conda/feedstock_root/build_artifacts/pathy_1687286298811/work peft @ file:///home/conda/feedstock_root/build_artifacts/peft_1702427737653/work pexpect @ file:///home/conda/feedstock_root/build_artifacts/pexpect_1667297516076/work pickleshare @ file:///home/conda/feedstock_root/build_artifacts/pickleshare_1602536217715/work pillow @ file:///Users/runner/miniforge3/conda-bld/pillow_1704252136304/work platformdirs==3.11.0 plotly @ file:///home/conda/feedstock_root/build_artifacts/plotly_1698272730927/work pluggy @ file:///home/conda/feedstock_root/build_artifacts/pluggy_1693086607691/work pre-commit @ file:///home/conda/feedstock_root/build_artifacts/pre-commit_1702177249902/work preshed @ file:///Users/runner/miniforge3/conda-bld/preshed_1695645021215/work prompt-toolkit @ file:///home/conda/feedstock_root/build_artifacts/prompt-toolkit_1702399386289/work proto-plus @ file:///home/conda/feedstock_root/build_artifacts/proto-plus_1702003338643/work protobuf==4.24.4 psutil @ file:///Users/runner/miniforge3/conda-bld/psutil_1702833179894/work ptyprocess @ file:///home/conda/feedstock_root/build_artifacts/ptyprocess_1609419310487/work/dist/ptyprocess-0.7.0-py2.py3-none-any.whl pure-eval @ file:///home/conda/feedstock_root/build_artifacts/pure_eval_1642875951954/work pyarrow==14.0.2 pyarrow-hotfix @ file:///home/conda/feedstock_root/build_artifacts/pyarrow-hotfix_1700596371886/work pyasn1 @ file:///home/conda/feedstock_root/build_artifacts/pyasn1_1701287008248/work pyasn1-modules @ file:///home/conda/feedstock_root/build_artifacts/pyasn1-modules_1695107857548/work pycosat @ file:///Users/runner/miniforge3/conda-bld/pycosat_1696355969704/work pycparser @ file:///home/conda/feedstock_root/build_artifacts/pycparser_1636257122734/work pydantic @ file:///home/conda/feedstock_root/build_artifacts/pydantic_1703248379805/work pydantic_core @ file:///Users/runner/miniforge3/conda-bld/pydantic-core_1703318578880/work pydot==2.0.0 pygit2==1.13.3 Pygments @ file:///home/conda/feedstock_root/build_artifacts/pygments_1700607939962/work pygtrie==2.5.0 pyOpenSSL @ file:///home/conda/feedstock_root/build_artifacts/pyopenssl_1698795453264/work pyparsing @ file:///home/conda/feedstock_root/build_artifacts/pyparsing_1690737849915/work PySocks @ file:///home/conda/feedstock_root/build_artifacts/pysocks_1661604839144/work pytest @ file:///home/conda/feedstock_root/build_artifacts/pytest_1704035161844/work pytest-cov @ file:///home/conda/feedstock_root/build_artifacts/pytest-cov_1684964868191/work pytest-subtests @ file:///home/conda/feedstock_root/build_artifacts/pytest-subtests_1684165519839/work python-dateutil @ file:///home/conda/feedstock_root/build_artifacts/python-dateutil_1626286286081/work python-dotenv @ file:///home/conda/feedstock_root/build_artifacts/python-dotenv-split_1693865766170/work python-slugify @ file:///home/conda/feedstock_root/build_artifacts/python-slugify-split_1694282063120/work pytz @ file:///home/conda/feedstock_root/build_artifacts/pytz_1693930252784/work pyu2f @ file:///home/conda/feedstock_root/build_artifacts/pyu2f_1604248910016/work PyYAML @ file:///Users/runner/miniforge3/conda-bld/pyyaml_1695373498369/work regex @ file:///Users/runner/miniforge3/conda-bld/regex_1703393590908/work requests @ file:///home/conda/feedstock_root/build_artifacts/requests_1684774241324/work responses @ file:///home/conda/feedstock_root/build_artifacts/responses_1643839609465/work rich @ file:///home/conda/feedstock_root/build_artifacts/rich-split_1700160075651/work/dist rsa @ file:///home/conda/feedstock_root/build_artifacts/rsa_1658328885051/work ruamel.yaml @ file:///Users/runner/miniforge3/conda-bld/ruamel.yaml_1699007390921/work ruamel.yaml.clib @ file:///Users/runner/miniforge3/conda-bld/ruamel.yaml.clib_1695996997220/work s3fs==2023.12.2 s3transfer==0.8.2 sacremoses @ file:///home/conda/feedstock_root/build_artifacts/sacremoses_1651557636210/work safetensors @ file:///Users/runner/miniforge3/conda-bld/safetensors_1695444684081/work scikit-learn @ file:///Users/runner/miniforge3/conda-bld/scikit-learn_1701932105294/work SciPy @ file:///Users/runner/miniforge3/conda-bld/scipy-split_1700812700233/work/dist/scipy-1.11.4-cp310-cp310-macosx_11_0_arm64.whl#sha256=375d32c2e30658f658c57cabef9cbbe6df2df8a14f5cb858d49fc66e910be7a5 scmrepo==2.0.2 semver==3.0.2 sentry-sdk @ file:///home/conda/feedstock_root/build_artifacts/sentry-sdk_1702552878331/work setproctitle @ file:///Users/runner/miniforge3/conda-bld/setproctitle_1696431399513/work shapely @ file:///Users/runner/miniforge3/conda-bld/shapely_1700763180770/work shellingham @ file:///home/conda/feedstock_root/build_artifacts/shellingham_1698144360966/work shortuuid==1.0.11 shtab==1.6.5 six @ file:///home/conda/feedstock_root/build_artifacts/six_1620240208055/work smart-open @ file:///home/conda/feedstock_root/build_artifacts/smart_open_1630238320325/work smmap @ file:///home/conda/feedstock_root/build_artifacts/smmap_1634310307496/work sniffio @ file:///home/conda/feedstock_root/build_artifacts/sniffio_1662051266223/work soupsieve @ file:///home/conda/feedstock_root/build_artifacts/soupsieve_1693929250441/work spacy @ file:///Users/runner/miniforge3/conda-bld/spacy_1699195026989/work spacy-curated-transformers==0.2.1 spacy-legacy @ file:///home/conda/feedstock_root/build_artifacts/spacy-legacy_1674550301837/work spacy-loggers @ file:///home/conda/feedstock_root/build_artifacts/spacy-loggers_1694527114282/work SQLAlchemy @ file:///Users/runner/miniforge3/conda-bld/sqlalchemy_1704267595749/work sqltrie==0.11.0 srsly @ file:///Users/runner/miniforge3/conda-bld/srsly_1695654012378/work stack-data @ file:///home/conda/feedstock_root/build_artifacts/stack_data_1669632077133/work sympy @ file:///home/conda/feedstock_root/build_artifacts/sympy_1684180540116/work tabulate==0.9.0 -e git+ssh://git@gitlab.ets.org/nlplab/ACG/tc_toeic.git@d3e677a3bd74d50fd598843356c76377c95fb41a#egg=tc_toeic tenacity @ file:///home/conda/feedstock_root/build_artifacts/tenacity_1692026804430/work text-unidecode @ file:///home/conda/feedstock_root/build_artifacts/text-unidecode_1694707102786/work thinc @ file:///Users/runner/miniforge3/conda-bld/thinc_1703842284464/work threadpoolctl @ file:///home/conda/feedstock_root/build_artifacts/threadpoolctl_1689261241048/work tokenizers @ file:///Users/runner/miniforge3/conda-bld/tokenizers_1702395225690/work/bindings/python toml @ file:///home/conda/feedstock_root/build_artifacts/toml_1604308577558/work tomli @ file:///home/conda/feedstock_root/build_artifacts/tomli_1644342247877/work tomlkit==0.12.3 torch @ file:///Users/runner/miniforge3/conda-bld/pytorch-recipe_1699313532615/work tqdm @ file:///home/conda/feedstock_root/build_artifacts/tqdm_1691671248568/work traitlets @ file:///home/conda/feedstock_root/build_artifacts/traitlets_1704212992681/work transformers @ file:///home/conda/feedstock_root/build_artifacts/transformers_1702954525852/work trl==0.7.7 truststore @ file:///home/conda/feedstock_root/build_artifacts/truststore_1694154605758/work typer @ file:///home/conda/feedstock_root/build_artifacts/typer_1683029246636/work types-python-dateutil @ file:///home/conda/feedstock_root/build_artifacts/types-python-dateutil_1704512562698/work types-pytz @ file:///home/conda/feedstock_root/build_artifacts/types-pytz_1695236566539/work typing-inspect @ file:///home/conda/feedstock_root/build_artifacts/typing_inspect_1685820062773/work typing_extensions @ file:///home/conda/feedstock_root/build_artifacts/typing_extensions_1702176139754/work tyro==0.6.3 tzdata @ file:///home/conda/feedstock_root/build_artifacts/python-tzdata_1703878702368/work ukkonen @ file:///Users/runner/miniforge3/conda-bld/ukkonen_1695549417166/work unicodedata2 @ file:///Users/runner/miniforge3/conda-bld/unicodedata2_1695848003431/work urllib3 @ file:///home/conda/feedstock_root/build_artifacts/urllib3_1697813446430/work vine==5.1.0 virtualenv @ file:///home/conda/feedstock_root/build_artifacts/virtualenv_1701458794382/work voluptuous==0.14.1 wandb @ file:///home/conda/feedstock_root/build_artifacts/wandb_1701816462763/work wasabi @ file:///Users/runner/miniforge3/conda-bld/wasabi_1686131568298/work wcwidth @ file:///home/conda/feedstock_root/build_artifacts/wcwidth_1704731205417/work weasel @ file:///home/conda/feedstock_root/build_artifacts/weasel_1699295455892/work wrapt==1.16.0 xxhash @ file:///Users/runner/miniforge3/conda-bld/python-xxhash_1696486346782/work yarl @ file:///Users/runner/miniforge3/conda-bld/yarl_1701168657467/work zc.lockfile==3.0.post1 zipp @ file:///home/conda/feedstock_root/build_artifacts/zipp_1695255097490/work zstandard==0.22.0 ```

Steps to reproduce

This error surfaced for me when training a simple adapter network, tarring up the resulting directory and then trying to use cached path to load it with extract_archive=True. This was meant to be used to load the archive from s3 but this bug also surfaces when using a local version of the tar file. It seems that this is because the .bin file used for the adapters is a zip file and when the zipfile

Example source:

Here's an example without all the adapter training business, just a simple zip file inside of a tar file. ```bash mkdir tar_file_contents mkdir zip_file_contents echo "this is a file" > tar_file_contents/test.txt echo "contents of zip file" > zip_file_contents/zip_stuff.txt zip zip_file.zip zip_file_contents mv zip_file.zip tar_file_contents/. tar -cvf tar_file.tar tar_file_contents ``` ```python from cached_path import cached_path a = cached_path("tar_file.tar", extract_archive=True) print([file for file in a.glob("*")]) # PosixPath(".../.cache/cached_path/00852777927f1f0159fb7298f0204501a8121cf9a58cd21ce16ba5dcc3ea729e.a4d2e804694f78926f5a02e7101a45207584442f43e91e68ea5e930fddf1f655-extracted/zip_file_contents") ``` I would expect test.txt to also show up and for the zip file to remain compressed inside the extracted folder. E.g. the contents of `-extracted` should match the contents of the `tar_file_contents` folder.

ksteimel commented 10 months ago

Changing line 245 of _cached_path.py from if is_zipfile(file_path): to if file_path.suffix == "zip" fixes the issue for me.

epwalsh commented 10 months ago

Hey @ksteimel, thanks for the bug report. I believe #210 should fix. Can you confirm before I merge?