fix: some errors

This commit is contained in:
wangcham
2026-02-17 22:21:53 +08:00
parent 10dd8c86d0
commit b7e1e43fbd

View File

@@ -801,6 +801,9 @@ class MonitoringService:
"""Escape a field for CSV output""" """Escape a field for CSV output"""
if field is None: if field is None:
return '' return ''
# Convert non-string types to string first
if not isinstance(field, str):
field = str(field)
# Replace common escape sequences # Replace common escape sequences
field = field.replace('\r\n', '\n').replace('\r', '\n') field = field.replace('\r\n', '\n').replace('\r', '\n')
# If field contains comma, double quote, or newline, wrap in quotes # If field contains comma, double quote, or newline, wrap in quotes