From 4b076d199b6d98c88483c5fecd5b48f23f6318a4 Mon Sep 17 00:00:00 2001 From: Catalin Ancutei <37979489+Catalyn45@users.noreply.github.com> Date: Mon, 18 Mar 2024 01:01:00 +0200 Subject: [PATCH] Fixed tags on windows (#1646) * Fixed tags on windows * Use the variable text directly in error message --- nav.go | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/nav.go b/nav.go index 31788001..d6014fe3 100644 --- a/nav.go +++ b/nav.go @@ -1926,10 +1926,15 @@ func (nav *nav) readTags() error { scanner := bufio.NewScanner(f) for scanner.Scan() { - path, tag, found := strings.Cut(scanner.Text(), ":") - if !found { - return fmt.Errorf("invalid tags file entry: %s", scanner.Text()) + text := scanner.Text() + + ind := strings.LastIndex(text, ":") + if ind == -1 { + return fmt.Errorf("invalid tags file entry: %s", text) } + + path := text[0:ind] + tag := text[ind+1:] if _, ok := nav.tags[path]; !ok { nav.tags[path] = tag }