Compare commits

..

No commits in common. "66b2743d3dfc0ac34b8f026da93a8c583e7877b0" and "3723b2b5e64cc69c61355f334c656906c82e5353" have entirely different histories.

3 changed files with 9 additions and 4 deletions

View File

@ -32,12 +32,9 @@ func GenerateRSS(c *Config, db *DB) (*string, error) {
tagNames = append(tagNames, tag.Name) tagNames = append(tagNames, tag.Name)
} }
if article.IsInIssue || article.AutoGenerated { if article.IsInIssue {
tagNames = append(tagNames, fmt.Sprint("Orient Express ", article.IssueID)) tagNames = append(tagNames, fmt.Sprint("Orient Express ", article.IssueID))
} }
if article.AutoGenerated {
tagNames = append(tagNames, "autogenerated")
}
user, err := db.GetUser(article.AuthorID) user, err := db.GetUser(article.AuthorID)
if err != nil { if err != nil {

View File

@ -69,6 +69,7 @@ func PublishLatestIssue(c *b.Config, db *b.DB, s *b.CookieStore) http.HandlerFun
AuthorID: session.Values["id"].(int64), AuthorID: session.Values["id"].(int64),
AutoGenerated: true, AutoGenerated: true,
} }
fmt.Println(article.Link)
article.ID, err = db.AddArticle(article) article.ID, err = db.AddArticle(article)
if err != nil { if err != nil {

View File

@ -14,16 +14,19 @@ import (
func UploadPDF(c *b.Config, s *b.CookieStore) http.HandlerFunc { func UploadPDF(c *b.Config, s *b.CookieStore) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) { return func(w http.ResponseWriter, r *http.Request) {
fmt.Println("Content-Type:", r.Header.Get("Content-Type"))
if _, err := getSession(w, r, c, s); err != nil { if _, err := getSession(w, r, c, s); err != nil {
return return
} }
fmt.Println(1)
if err := r.ParseMultipartForm(10 << 20); err != nil { if err := r.ParseMultipartForm(10 << 20); err != nil {
log.Println(err) log.Println(err)
http.Error(w, err.Error(), http.StatusBadRequest) http.Error(w, err.Error(), http.StatusBadRequest)
return return
} }
fmt.Println(2)
file, _, err := r.FormFile("pdf-upload") file, _, err := r.FormFile("pdf-upload")
if err != nil { if err != nil {
log.Println(err) log.Println(err)
@ -32,6 +35,7 @@ func UploadPDF(c *b.Config, s *b.CookieStore) http.HandlerFunc {
} }
defer file.Close() defer file.Close()
fmt.Println(3)
filename := fmt.Sprint(uuid.New(), ".pdf") filename := fmt.Sprint(uuid.New(), ".pdf")
absFilepath, err := filepath.Abs(fmt.Sprint(c.PDFDir, "/", filename)) absFilepath, err := filepath.Abs(fmt.Sprint(c.PDFDir, "/", filename))
if err != nil { if err != nil {
@ -40,6 +44,7 @@ func UploadPDF(c *b.Config, s *b.CookieStore) http.HandlerFunc {
return return
} }
fmt.Println(4)
pdf, err := os.Create(absFilepath) pdf, err := os.Create(absFilepath)
if err != nil { if err != nil {
log.Println(err) log.Println(err)
@ -48,12 +53,14 @@ func UploadPDF(c *b.Config, s *b.CookieStore) http.HandlerFunc {
} }
defer pdf.Close() defer pdf.Close()
fmt.Println(5)
if _, err = io.Copy(pdf, file); err != nil { if _, err = io.Copy(pdf, file); err != nil {
log.Println(err) log.Println(err)
http.Error(w, err.Error(), http.StatusInternalServerError) http.Error(w, err.Error(), http.StatusInternalServerError)
return return
} }
fmt.Println(6)
w.WriteHeader(http.StatusOK) w.WriteHeader(http.StatusOK)
} }
} }