add "/" to basedir if not present
This commit is contained in:
parent
c2ad30bbc5
commit
c562e32f91
@ -3,6 +3,7 @@ package ginpongo2
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"github.com/flosch/pongo2"
|
"github.com/flosch/pongo2"
|
||||||
"github.com/gin-gonic/gin/render"
|
"github.com/gin-gonic/gin/render"
|
||||||
@ -49,6 +50,9 @@ func New(basedir string, debug bool) *Pongo {
|
|||||||
p := new(Pongo)
|
p := new(Pongo)
|
||||||
p.set = pongo2.NewSet("html")
|
p.set = pongo2.NewSet("html")
|
||||||
p.set.Debug = debug
|
p.set.Debug = debug
|
||||||
|
if !strings.HasSuffix(basedir, "/") {
|
||||||
|
basedir = basedir + "/"
|
||||||
|
}
|
||||||
p.basedir = basedir
|
p.basedir = basedir
|
||||||
return p
|
return p
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user