Description
Creating an instance of an Archive
with a pathlib.Path
fails with a ValueError "bad archive content".
Debugging the code, I suspect the following lines are responsible:
Lines 1749 to 1752 in 4d604d6
Since a Path
object has an attribute name
(and given that's checked first), the content
variable receives the final path component.
Therefore, when the code checks if content
is either a directory or file (lines 1754 and 1762), it will only be true if the final path element is either a subdirectory or file in the directory where the __init__.py
file resides.
I tried inverting the conditions of the if and elif statements on the cited snippet, i.e check if content
is an instance of Path
before checking it has the attribute name
, and it worked. However, given my limited knowledge of the library, I'm not sure if this would break in other scenarios.