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