From 2af0e76da1d9e2ac3ca62b231d85f4ff0939d50a Mon Sep 17 00:00:00 2001 From: wanghuancoder Date: Tue, 20 Feb 2024 17:28:21 +0800 Subject: [PATCH] merge --- python/paddle/utils/download.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/python/paddle/utils/download.py b/python/paddle/utils/download.py index b9ca1f35976c6..f7b49efe42501 100644 --- a/python/paddle/utils/download.py +++ b/python/paddle/utils/download.py @@ -340,7 +340,13 @@ def _uncompress_file_zip(filepath): def _uncompress_file_tar(filepath, mode="r:*"): with tarfile.open(filepath, mode) as files: - file_list = files.getnames() + file_list_tmp = files.getnames() + file_list = [] + for file in file_list_tmp: + assert ( + file[0] != "/" + ), f"uncompress file path {file} should not start with /" + file_list.append(file.replace("../", "")) file_dir = os.path.dirname(filepath)