From 4b8348941dd44e24f59584834e630f27fe3614cb Mon Sep 17 00:00:00 2001 From: Gerhard Sittig Date: Mon, 6 Jan 2020 09:59:21 +0100 Subject: [PATCH] input/csv: trim surrounding whitespace from header line channel names When CSV import grabs channel names from the first line in the file then the text strictly between column separators (a comma) was used. Which resulted in channel names like " channel 1". Trim leading and trailing space before unquote, to better fulfill most users' expectation. Users still can quote the input data for special cases if desired. --- src/input/csv.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/input/csv.c b/src/input/csv.c index 66cf4bb3..4dcc77b8 100644 --- a/src/input/csv.c +++ b/src/input/csv.c @@ -657,10 +657,12 @@ static int make_column_details_from_format(const struct sr_input *in, * line won't get processed another time. */ column = column_texts[detail->col_nr - 1]; - if (inc->use_header && column && *column) + if (inc->use_header && column && *column) { + column = g_strstrip(column); caption = sr_scpi_unquote_string(column); - else + } else { caption = NULL; + } if (!caption || !*caption) caption = NULL; /* -- 2.30.2