From c8fbae3cfe849bebe185712cdbded9d2ec4dbc16 Mon Sep 17 00:00:00 2001 From: Park Wonjae Date: Fri, 3 Jul 2026 09:52:41 +0900 Subject: [PATCH] fix(write_excel): handle None values and avoid redundant str() - Convert None values to empty strings to avoid writing 'None'. - Store the string converted value to avoid calling str() repeatedly when checking and writing URL cells. Signed-off-by: Park Wonjae --- src/fosslight_util/write_excel.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/fosslight_util/write_excel.py b/src/fosslight_util/write_excel.py index 24e60b0..618cc0c 100755 --- a/src/fosslight_util/write_excel.py +++ b/src/fosslight_util/write_excel.py @@ -215,10 +215,11 @@ def write_result_to_sheet(worksheet, sheet_contents): for row_item in sheet_contents: worksheet.write(row, 0, row) for col_num, value in enumerate(row_item): + value = "" if value is None else str(value) if len(value) > MAX_EXCEL_URL_LENGTH and (value.startswith("http://") or value.startswith("https://")): - worksheet.write_string(row, col_num + 1, str(value)) + worksheet.write_string(row, col_num + 1, value) else: - worksheet.write(row, col_num + 1, str(value)) + worksheet.write(row, col_num + 1, value) row += 1