Fixed bug
This commit is contained in:
parent
92189a4a51
commit
b88fb1643c
@ -413,8 +413,9 @@ func UploadImage(c *control.CliArgs) http.HandlerFunc {
|
||||
}
|
||||
defer file.Close()
|
||||
|
||||
filename := fmt.Sprint(c.PicsDir, "/", time.Now().Format("2006-01-02_15:04:05"), "-", header.Filename)
|
||||
absFilepath, err := filepath.Abs(filename)
|
||||
filename := fmt.Sprint(time.Now().Format("2006-01-02_15:04:05"), "-",
|
||||
header.Filename)
|
||||
absFilepath, err := filepath.Abs(fmt.Sprint(c.PicsDir, "/", filename))
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||
@ -435,8 +436,8 @@ func UploadImage(c *control.CliArgs) http.HandlerFunc {
|
||||
return
|
||||
}
|
||||
|
||||
imgMD := fmt.Sprint("![", header.Filename, "](/pics/", filename, ")")
|
||||
tmpl, err := template.ParseFiles(c.WebDir + "/templates/editor.html")
|
||||
tmpl = template.Must(tmpl, err)
|
||||
tmpl.ExecuteTemplate(w, "editor-images", fmt.Sprint("![", header.Filename, "](", filename, ")"))
|
||||
template.Must(tmpl, err).ExecuteTemplate(w, "editor-images", imgMD)
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user