Skip to content

Commit

Permalink
add trailing slash
Browse files Browse the repository at this point in the history
  • Loading branch information
Kirari04 committed Apr 9, 2024
1 parent d86e1a9 commit 8052e96
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions controllers/CreateWebPageController.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"ch/kirari04/videocms/helpers"
"ch/kirari04/videocms/inits"
"ch/kirari04/videocms/models"
"fmt"
"log"
"net/http"

Expand All @@ -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,
Expand Down

0 comments on commit 8052e96

Please sign in to comment.