fix bug
This commit is contained in:
@@ -40,12 +40,17 @@ func (client *Client) Serve(file string) error {
|
|||||||
if err == nil && regex.MatchString(r.URL.Path) {
|
if err == nil && regex.MatchString(r.URL.Path) {
|
||||||
// Open file and convert to html
|
// Open file and convert to html
|
||||||
bytes, err := readToString(dir, r.URL.Path)
|
bytes, err := readToString(dir, r.URL.Path)
|
||||||
|
if err != nil {
|
||||||
|
log.Fatal(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
htmlContent := client.MdToHTML(bytes)
|
htmlContent := client.MdToHTML(bytes)
|
||||||
|
|
||||||
// Serve
|
// Serve
|
||||||
err = serveTemplate(w, htmlStruct{Content: string(htmlContent), Darkmode: client.Dark})
|
err = serveTemplate(w, htmlStruct{Content: string(htmlContent), Darkmode: client.Dark})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
|
return
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
chttp.ServeHTTP(w, r)
|
chttp.ServeHTTP(w, r)
|
||||||
|
|||||||
Reference in New Issue
Block a user