Fix panic on draft posts

This commit is contained in:
Timur Demin 2020-11-19 03:32:55 +05:00
parent b660e0b1da
commit 6859f3d57c
No known key found for this signature in database
GPG key ID: 9EDF3F9D9286FA20

View file

@ -56,6 +56,7 @@ package main
import (
"bytes"
"errors"
"flag"
"io"
"io/ioutil"
@ -192,12 +193,11 @@ func main() {
return err
}
gemText, metadata, err := gemini.RenderMarkdown(fileContent, gemini.WithoutMetadata)
if err != nil {
return err
}
// skip drafts from rendering
if metadata.PostIsDraft {
if errors.Is(err, gemini.ErrPostIsDraft) {
return nil
} else if err != nil {
return err
}
key := strings.TrimPrefix(strings.TrimSuffix(path, ".md"), contentBase) + ".gmi"
p := post{