From 3ff5da6f1a1707e3328a9c6e602bbcc9bf7823da Mon Sep 17 00:00:00 2001 From: viljarb Date: Fri, 6 Mar 2026 17:58:25 +0100 Subject: [PATCH] copilot suggestion fix: using url.Values to prevent bad characters messing up the url --- pkg/web/handler/modals.go | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/pkg/web/handler/modals.go b/pkg/web/handler/modals.go index 5a07676..6438ce2 100644 --- a/pkg/web/handler/modals.go +++ b/pkg/web/handler/modals.go @@ -2,6 +2,7 @@ package handler import ( "net/http" + "net/url" "github.com/LazyBachelor/LazyPM/internal/models" "github.com/LazyBachelor/LazyPM/pkg/web/components" @@ -12,7 +13,9 @@ func CreateIssueFormModal(w http.ResponseWriter, r *http.Request) { from := r.URL.Query().Get("from") postAction := "/issues" if from != "" { - postAction += "?from=" + from + v := url.Values{} + v.Set("from", from) + postAction += "?" + v.Encode() } modalContent := components.IssueForm(components.IssueFormProps{ @@ -45,8 +48,11 @@ func EditIssueFormModal(w http.ResponseWriter, r *http.Request) { patchAction := "/issues/" + issue.ID deleteAction := "/issues/" + issue.ID + "/delete" if from != "" { - patchAction += "?from=" + from - deleteAction += "?from=" + from + v := url.Values{} + v.Set("from", from) + q := v.Encode() + patchAction += "?" + q + deleteAction += "?" + q } modalContent := components.IssueForm(components.IssueFormProps{ @@ -103,7 +109,9 @@ func DeleteIssueConfirmModal(w http.ResponseWriter, r *http.Request) { from := r.URL.Query().Get("from") deleteAction := "/issues/" + issue.ID if from != "" { - deleteAction += "?from=" + from + v := url.Values{} + v.Set("from", from) + deleteAction += "?" + v.Encode() } confirmModal := components.ConfirmModal(components.ConfirmModalProps{