add "/" to basedir if not present

This commit is contained in:
Darko Luketic 2020-03-19 21:00:34 +01:00
parent c2ad30bbc5
commit c562e32f91

View File

@ -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
}