diff --git a/cve-agency-manager/cve_tracking/core/download/save.py b/cve-agency-manager/cve_tracking/core/download/save.py index e005991cdc65def538cecee40508cfeaac7737e1..457d6f349b382465cf6ef931511a142680ce50f5 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()