From f28f86fa35cc2c8fc08b4e470b367d49bf416bc5 Mon Sep 17 00:00:00 2001 From: xuyongliang_01 Date: Fri, 8 Sep 2023 02:07:51 +0000 Subject: [PATCH] =?UTF-8?q?update=20cve-agency-manager/cve=5Ftracking/core?= =?UTF-8?q?/download/save.py.=20=E4=B8=8B=E8=BD=BD=E8=A1=A5=E4=B8=81?= =?UTF-8?q?=E6=97=B6=EF=BC=8C=E7=BB=8F=E5=B8=B8=E5=87=BA=E7=8E=B0=E9=94=99?= =?UTF-8?q?=E8=AF=AF=E7=9A=84hxml=E7=BD=91=E9=A1=B5=E6=96=87=E4=BB=B6?= =?UTF-8?q?=EF=BC=8C=E9=9C=80=E5=88=A0=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: xuyongliang_01 --- .../cve_tracking/core/download/save.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/cve-agency-manager/cve_tracking/core/download/save.py b/cve-agency-manager/cve_tracking/core/download/save.py index e005991..457d6f3 100644 --- a/cve-agency-manager/cve_tracking/core/download/save.py +++ b/cve-agency-manager/cve_tracking/core/download/save.py @@ -75,6 +75,12 @@ def save_patch(patch_details=None, path=CONFIG.PATCH_SAVE_PATH, args=None): file = http.download(url=patch_url, out_fname=out_file) if not file: logger.error("Failed to download the file: %s" % patch_url) + else: + frfile = open(out_file) + line = frfile.readlines() + if line[0].strip() == '': + os.remove(out_file) + frfile.close() return None else: patch_url_state = {} @@ -85,6 +91,12 @@ def save_patch(patch_details=None, path=CONFIG.PATCH_SAVE_PATH, args=None): if not file: logger.error("Failed to download the file: %s" % patch_url) patch_url_state[url] = "不适配" + else: + frfile = open(out_file) + line = frfile.readlines() + if line[0].strip() == '': + os.remove(out_file) + frfile.close() patch_apply = PathApply(rpm_name=args.rpm_name, patch_path=args.patch_path, source_path=args.source_path, branch_rpm=args.branch, cve_num=args.cve_num) stat = patch_apply.packing_source() -- Gitee