Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions python/dgl/data/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ def check_sha1(filename, sha1_hash):
return sha1.hexdigest() == sha1_hash


def extract_archive(file, target_dir, overwrite=True):
def extract_archive(file, target_dir, overwrite=True, filter="data"):
"""Extract archive file.

Parameters
Expand Down Expand Up @@ -282,7 +282,9 @@ def safe_extract(
member_path = os.path.join(path, member.name)
if not is_within_directory(path, member_path):
raise Exception("Attempted Path Traversal in Tar File")
tar.extractall(path, members, numeric_owner=numeric_owner)
tar.extractall(
path, members, numeric_owner=numeric_owner, filter=filter
)

safe_extract(archive, path=target_dir)
elif file.endswith(".gz"):
Expand Down
6 changes: 4 additions & 2 deletions python/dgl/graphbolt/internal_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ def check_sha1(filename, sha1_hash):
return sha1.hexdigest() == sha1_hash


def extract_archive(file, target_dir, overwrite=True):
def extract_archive(file, target_dir, overwrite=True, filter="data"):
"""Extract archive file.

Parameters
Expand Down Expand Up @@ -351,7 +351,9 @@ def safe_extract(
member_path = os.path.join(path, member.name)
if not is_within_directory(path, member_path):
raise Exception("Attempted Path Traversal in Tar File")
tar.extractall(path, members, numeric_owner=numeric_owner)
tar.extractall(
path, members, numeric_owner=numeric_owner, filter=filter
)

safe_extract(archive, path=target_dir)
elif file.endswith(".gz"):
Expand Down
Loading