◐ Shell
clean mode source ↗

shutil.unpack_archive skips false negatives containing '..'

I tried to extract a ZIP archive which contains a file named somefile..ipynb using shutil.unpack_archive.

This is right, one file inside the archive is named somefile..ipynb, with two dots, likely misspelled.

This leads to a problem, because unpack_archive will skip extracting this file here, because it assumes that the file contains relative path components. The file is missing quietly in the extracted archive.

While skipping the file is different from standard behavior, the assumption that a file with a path containing two dots would be a relative path is also wrong. A relative path component is identified by "../" instead.

I can am going to submit a PR.

Linked PRs