From 46b566a92b33cbfe62f6e4b25bb61bdeeed88edf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Mierzwa?= Date: Fri, 28 Oct 2022 12:38:51 +0100 Subject: [PATCH] fix(backend): fix links with spaces --- internal/models/annotation.go | 2 ++ internal/models/annotation_test.go | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/internal/models/annotation.go b/internal/models/annotation.go index 75710cf2b..0a43c097b 100644 --- a/internal/models/annotation.go +++ b/internal/models/annotation.go @@ -81,6 +81,8 @@ var linkSchemes = []string{ } func isLink(s string) bool { + s = strings.TrimSpace(s) + if strings.Contains(s, " ") { return false } diff --git a/internal/models/annotation_test.go b/internal/models/annotation_test.go index b56ebddf2..4d0d6a3e9 100644 --- a/internal/models/annotation_test.go +++ b/internal/models/annotation_test.go @@ -66,7 +66,7 @@ var annotationMapsTestCases = []annotationMapsTestCase{ annotationMap: map[string]string{ "foo": "https://localhost/xxx", "abc": "xyz", - "act": "https://localhost/act", + "act": "https://localhost/act ", }, annotations: models.Annotations{ models.Annotation{ @@ -78,7 +78,7 @@ var annotationMapsTestCases = []annotationMapsTestCase{ }, models.Annotation{ Name: "act", - Value: "https://localhost/act", + Value: "https://localhost/act ", Visible: true, IsLink: true, IsAction: true,