forked from jason/cpolis
Use proper filepaths
This commit is contained in:
@@ -5,6 +5,7 @@ import (
|
||||
"html/template"
|
||||
"log"
|
||||
"net/http"
|
||||
"path/filepath"
|
||||
|
||||
b "streifling.com/jason/cpolis/cmd/backend"
|
||||
)
|
||||
@@ -70,7 +71,7 @@ func UploadImage(c *b.Config, s map[string]*Session, fileKey, htmlFile, htmlTemp
|
||||
data := new(struct{ Image string })
|
||||
data.Image = filename
|
||||
|
||||
tmpl, err := template.ParseFiles(c.WebDir + "/templates/" + htmlFile)
|
||||
tmpl, err := template.ParseFiles(filepath.Join(c.WebDir, "templates", htmlFile))
|
||||
if err = template.Must(tmpl, err).ExecuteTemplate(w, htmlTemplate, data); err != nil {
|
||||
log.Println(err)
|
||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||
|
Reference in New Issue
Block a user