Skip to content

Commit

Permalink
Resolve Warnings for Extraction Filters.
Browse files Browse the repository at this point in the history
  • Loading branch information
drivanov committed Nov 7, 2024
1 parent 88f109f commit a13a6b3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 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


Check warning on line 246 in python/dgl/data/utils.py

View workflow job for this annotation

GitHub Actions / lintrunner

UFMT format

Run `lintrunner -a` to apply this patch.
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,7 @@ 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
4 changes: 2 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


Check warning on line 315 in python/dgl/graphbolt/internal_utils.py

View workflow job for this annotation

GitHub Actions / lintrunner

UFMT format

Run `lintrunner -a` to apply this patch.
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,7 @@ 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

0 comments on commit a13a6b3

Please sign in to comment.