Skip to content

Commit

Permalink
Guard root path when unzipping archive (#2786)
Browse files Browse the repository at this point in the history
  • Loading branch information
ludeeus authored Jul 13, 2022
1 parent 3eb2982 commit 7089028
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion custom_components/hacs/repositories/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -619,7 +619,10 @@ async def download_repository_zip(self):
extractable = []
for path in zip_file.filelist:
filename = "/".join(path.filename.split("/")[1:])
if filename.startswith(self.content.path.remote):
if (
filename.startswith(self.content.path.remote)
and filename != self.content.path.remote
):
path.filename = filename.replace(self.content.path.remote, "")
extractable.append(path)

Expand Down

0 comments on commit 7089028

Please sign in to comment.