create webmention dir if not exist

This commit is contained in:
Niko Abeler 2022-08-31 20:43:01 +02:00
parent 61a5435971
commit a5250eb01c
1 changed files with 6 additions and 0 deletions

View File

@ -148,6 +148,9 @@ func (post *Post) LoadMeta() error {
}
func (post *Post) AddWebmention(source string) error {
// ensure dir exists
os.MkdirAll(post.WebmentionDir(), 0755)
hash := sha256.Sum256([]byte(source))
hashStr := base64.URLEncoding.EncodeToString(hash[:])
// Check if file already exists
@ -168,5 +171,8 @@ func (post *Post) AddWebmention(source string) error {
}
func (post *Post) Webmentions() []string {
// ensure dir exists
os.MkdirAll(post.WebmentionDir(), 0755)
return listDir(post.WebmentionDir())
}