From c562e32f916354ec4229b3215fb8251da5139930 Mon Sep 17 00:00:00 2001 From: Darko Luketic <2694548+dalu@users.noreply.github.com> Date: Thu, 19 Mar 2020 21:00:34 +0100 Subject: [PATCH] add "/" to basedir if not present --- render.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/render.go b/render.go index 3a73277..c59d1fb 100644 --- a/render.go +++ b/render.go @@ -3,6 +3,7 @@ package ginpongo2 import ( "fmt" "net/http" + "strings" "github.com/flosch/pongo2" "github.com/gin-gonic/gin/render" @@ -49,6 +50,9 @@ func New(basedir string, debug bool) *Pongo { p := new(Pongo) p.set = pongo2.NewSet("html") p.set.Debug = debug + if !strings.HasSuffix(basedir, "/") { + basedir = basedir + "/" + } p.basedir = basedir return p }