From a27d2e408367984643bec122c24ffc6616b06fde Mon Sep 17 00:00:00 2001 From: partisan Date: Wed, 26 Feb 2025 19:22:24 +0000 Subject: [PATCH] Update update_appindex.go --- update_appindex.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/update_appindex.go b/update_appindex.go index dc39410..1e75fa8 100644 --- a/update_appindex.go +++ b/update_appindex.go @@ -214,7 +214,6 @@ func removeExistingEntry(name, release, arch, origin, platform string) { if inEntry && len(currentEntry) > 0 { if !(pVal == name && rVal == release && aVal == arch && oVal == origin && plVal == platform) { newLines = append(newLines, currentEntry...) - newLines = append(newLines, "") // optional blank line } } // Start a new entry @@ -252,7 +251,11 @@ func removeExistingEntry(name, release, arch, origin, platform string) { } } + // Join and collapse multiple newlines into one finalContent := strings.Join(newLines, "\n") + re := regexp.MustCompile(`\n+`) + finalContent = re.ReplaceAllString(finalContent, "\n") + if !strings.HasSuffix(finalContent, "\n") { finalContent += "\n" }