Merge branch 'devel'
This commit is contained in:
		@@ -32,9 +32,12 @@ func GenerateRSS(c *Config, db *DB) (*string, error) {
 | 
				
			|||||||
			tagNames = append(tagNames, tag.Name)
 | 
								tagNames = append(tagNames, tag.Name)
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if article.IsInIssue {
 | 
							if article.IsInIssue || article.AutoGenerated {
 | 
				
			||||||
			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 {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -69,7 +69,6 @@ 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 {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -14,19 +14,16 @@ 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)
 | 
				
			||||||
@@ -35,7 +32,6 @@ 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 {
 | 
				
			||||||
@@ -44,7 +40,6 @@ 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)
 | 
				
			||||||
@@ -53,14 +48,12 @@ 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)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user