forked from jason/cpolis
Initial version of .docx upload support
This commit is contained in:
@@ -8,6 +8,7 @@ import (
|
||||
"os"
|
||||
"time"
|
||||
|
||||
"github.com/google/uuid"
|
||||
b "streifling.com/jason/cpolis/cmd/backend"
|
||||
)
|
||||
|
||||
@@ -26,6 +27,7 @@ func PublishLatestIssue(c *b.Config, db *b.DB, s map[string]*Session) http.Handl
|
||||
Rejected: false,
|
||||
Created: time.Now(),
|
||||
AutoGenerated: true,
|
||||
UUID: uuid.New(),
|
||||
}
|
||||
|
||||
if len(article.Title) == 0 {
|
||||
@@ -55,7 +57,7 @@ func PublishLatestIssue(c *b.Config, db *b.DB, s map[string]*Session) http.Handl
|
||||
return
|
||||
}
|
||||
|
||||
articleAbsName := fmt.Sprint(c.ArticleDir, "/", article.ID, ".md")
|
||||
articleAbsName := fmt.Sprint(c.ArticleDir, "/", article.UUID, ".md")
|
||||
if err = os.WriteFile(articleAbsName, content, 0644); err != nil {
|
||||
log.Println(err)
|
||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||
|
Reference in New Issue
Block a user