From 8052e96afcf9dccb3e5c74f2cb1627e2085620f3 Mon Sep 17 00:00:00 2001 From: kirari04 Date: Tue, 9 Apr 2024 17:31:25 +0200 Subject: [PATCH] add trailing slash --- controllers/CreateWebPageController.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/controllers/CreateWebPageController.go b/controllers/CreateWebPageController.go index 41da4da..20b15a4 100755 --- a/controllers/CreateWebPageController.go +++ b/controllers/CreateWebPageController.go @@ -4,6 +4,7 @@ import ( "ch/kirari04/videocms/helpers" "ch/kirari04/videocms/inits" "ch/kirari04/videocms/models" + "fmt" "log" "net/http" @@ -28,6 +29,10 @@ func CreateWebPage(c echo.Context) error { return c.String(http.StatusBadRequest, "Path already used") } + if validatus.Path[len(validatus.Path)-1] != '/' { + validatus.Path = fmt.Sprintf("%s/", validatus.Path) + } + webPage := models.WebPage{ Path: validatus.Path, Title: validatus.Title,