Drop redundant safecsv WriteRow helper
WriteRow was a variadic alias for Write(SanitizeRecord(...)) with no extra safety or column checks. Export call sites already use []string headers; matching encoding/csv keeps one API surface. Signed-off-by: Cursor Agent <cursoragent@cursor.com> Co-authored-by: Bryan FRIMIN <bryan@frimin.fr>
This commit is contained in:
@@ -41,18 +41,11 @@ func NewWriter(w io.Writer) *Writer {
|
||||
return &Writer{inner: csv.NewWriter(w)}
|
||||
}
|
||||
|
||||
// Write encodes a CSV record after sanitizing every field. Prefer WriteRow for
|
||||
// literal column values at call sites.
|
||||
// Write encodes a CSV record after sanitizing every field.
|
||||
func (w *Writer) Write(record []string) error {
|
||||
return w.inner.Write(SanitizeRecord(record))
|
||||
}
|
||||
|
||||
// WriteRow encodes one CSV record from fields, sanitizing each value before
|
||||
// encoding (spreadsheet formula injection mitigation).
|
||||
func (w *Writer) WriteRow(fields ...string) error {
|
||||
return w.inner.Write(SanitizeRecord(fields))
|
||||
}
|
||||
|
||||
func (w *Writer) Flush() {
|
||||
w.inner.Flush()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user