From 181b4e016897d8f74a07025efa32dfe1f77b2972 Mon Sep 17 00:00:00 2001 From: Markus Lehtonen Date: Fri, 4 Aug 2023 15:24:46 +0300 Subject: [PATCH] source/local: trim whitespace from input Trim leading and trailing whitespace from the input (from feature files and hooks). Makes it a bit more relaxed on the expected input format. --- source/local/local.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/source/local/local.go b/source/local/local.go index ede6cc9ad..abb1ad0bb 100644 --- a/source/local/local.go +++ b/source/local/local.go @@ -147,9 +147,10 @@ func (s *localSource) GetFeatures() *nfdv1alpha1.Features { func parseFeatures(lines [][]byte) map[string]string { features := make(map[string]string) - for _, line := range lines { + for _, l := range lines { + line := strings.TrimSpace(string(l)) if len(line) > 0 { - lineSplit := strings.SplitN(string(line), "=", 2) + lineSplit := strings.SplitN(line, "=", 2) key := lineSplit[0]