Commit c98e40ff authored by Chris Lamb's avatar Chris Lamb 💬

To match the libarchive container, raise a KeyError exception if we request an...

To match the libarchive container, raise a KeyError exception if we request an invalid member from a directory container.
parent 2478e9c0
......@@ -266,9 +266,11 @@ class DirectoryContainer(Container):
if not os.path.islink(member_path) and os.path.isdir(member_path):
return FilesystemDirectory(member_path)
return FilesystemFile(
os.path.join(self.source.path, member_name), container=self
)
path = os.path.join(self.source.path, member_name)
if not os.path.exists(path):
raise KeyError("%s not found in directory" % member_name)
return FilesystemFile(path, container=self)
def comparisons(self, other):
my_members = collections.OrderedDict(self.get_adjusted_members_sizes())
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment