copilot suggestion fix: using url.Values to prevent bad characters messing up the url
This commit is contained in:
@@ -2,6 +2,7 @@ package handler
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"net/url"
|
||||||
|
|
||||||
"github.com/LazyBachelor/LazyPM/internal/models"
|
"github.com/LazyBachelor/LazyPM/internal/models"
|
||||||
"github.com/LazyBachelor/LazyPM/pkg/web/components"
|
"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")
|
from := r.URL.Query().Get("from")
|
||||||
postAction := "/issues"
|
postAction := "/issues"
|
||||||
if from != "" {
|
if from != "" {
|
||||||
postAction += "?from=" + from
|
v := url.Values{}
|
||||||
|
v.Set("from", from)
|
||||||
|
postAction += "?" + v.Encode()
|
||||||
}
|
}
|
||||||
|
|
||||||
modalContent := components.IssueForm(components.IssueFormProps{
|
modalContent := components.IssueForm(components.IssueFormProps{
|
||||||
@@ -45,8 +48,11 @@ func EditIssueFormModal(w http.ResponseWriter, r *http.Request) {
|
|||||||
patchAction := "/issues/" + issue.ID
|
patchAction := "/issues/" + issue.ID
|
||||||
deleteAction := "/issues/" + issue.ID + "/delete"
|
deleteAction := "/issues/" + issue.ID + "/delete"
|
||||||
if from != "" {
|
if from != "" {
|
||||||
patchAction += "?from=" + from
|
v := url.Values{}
|
||||||
deleteAction += "?from=" + from
|
v.Set("from", from)
|
||||||
|
q := v.Encode()
|
||||||
|
patchAction += "?" + q
|
||||||
|
deleteAction += "?" + q
|
||||||
}
|
}
|
||||||
|
|
||||||
modalContent := components.IssueForm(components.IssueFormProps{
|
modalContent := components.IssueForm(components.IssueFormProps{
|
||||||
@@ -103,7 +109,9 @@ func DeleteIssueConfirmModal(w http.ResponseWriter, r *http.Request) {
|
|||||||
from := r.URL.Query().Get("from")
|
from := r.URL.Query().Get("from")
|
||||||
deleteAction := "/issues/" + issue.ID
|
deleteAction := "/issues/" + issue.ID
|
||||||
if from != "" {
|
if from != "" {
|
||||||
deleteAction += "?from=" + from
|
v := url.Values{}
|
||||||
|
v.Set("from", from)
|
||||||
|
deleteAction += "?" + v.Encode()
|
||||||
}
|
}
|
||||||
|
|
||||||
confirmModal := components.ConfirmModal(components.ConfirmModalProps{
|
confirmModal := components.ConfirmModal(components.ConfirmModalProps{
|
||||||
|
|||||||
Reference in New Issue
Block a user