From c1f8bd74b5a325acaa9c33cee4f11fcba734dda2 Mon Sep 17 00:00:00 2001 From: pedrooot Date: Wed, 7 Oct 2026 17:45:44 +0200 Subject: [PATCH] refactor(outputs): drop the empty except in the sanitiser --- prowler/lib/outputs/utils.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/prowler/lib/outputs/utils.py b/prowler/lib/outputs/utils.py index 2e7ee76dc8..4524cd9542 100644 --- a/prowler/lib/outputs/utils.py +++ b/prowler/lib/outputs/utils.py @@ -211,10 +211,11 @@ def sanitize_csv_value(value): ): return value try: - # float() also accepts nan/inf and padded forms, which a spreadsheet - # renders as text, so only a finite number is left untouched - if isfinite(float(value)) and value == value.strip(): - return value + number = float(value) except ValueError: - pass + return f"'{value}" + # float() also accepts nan/inf and whitespace-padded forms, which a spreadsheet + # renders as text rather than as a number + if isfinite(number) and value == value.strip(): + return value return f"'{value}"