Merge branch 'devel'
This commit is contained in:
		@@ -5,6 +5,7 @@ import (
 | 
				
			|||||||
	"log"
 | 
						"log"
 | 
				
			||||||
	"net/http"
 | 
						"net/http"
 | 
				
			||||||
	"path/filepath"
 | 
						"path/filepath"
 | 
				
			||||||
 | 
						"strings"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	"github.com/google/uuid"
 | 
						"github.com/google/uuid"
 | 
				
			||||||
	b "streifling.com/jason/cpolis/cmd/backend"
 | 
						b "streifling.com/jason/cpolis/cmd/backend"
 | 
				
			||||||
@@ -17,7 +18,7 @@ func UploadPDF(c *b.Config, s map[string]*Session) http.HandlerFunc {
 | 
				
			|||||||
			return
 | 
								return
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		file, _, err := r.FormFile("pdf-upload")
 | 
							file, header, err := r.FormFile("pdf-upload")
 | 
				
			||||||
		if err != nil {
 | 
							if err != nil {
 | 
				
			||||||
			log.Println(err)
 | 
								log.Println(err)
 | 
				
			||||||
			http.Error(w, err.Error(), http.StatusInternalServerError)
 | 
								http.Error(w, err.Error(), http.StatusInternalServerError)
 | 
				
			||||||
@@ -43,7 +44,9 @@ func UploadPDF(c *b.Config, s map[string]*Session) http.HandlerFunc {
 | 
				
			|||||||
			return
 | 
								return
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		filename := fmt.Sprint(uuid.New(), ".pdf")
 | 
							oldFilename := header.Filename
 | 
				
			||||||
 | 
							oldFilename = strings.Join(strings.Split(oldFilename, ".")[:len(oldFilename)-1], ".")
 | 
				
			||||||
 | 
							filename := fmt.Sprint(oldFilename, ".", uuid.New(), ".pdf")
 | 
				
			||||||
		absFilepath, err := filepath.Abs(c.PDFDir + "/" + filename)
 | 
							absFilepath, err := filepath.Abs(c.PDFDir + "/" + filename)
 | 
				
			||||||
		if err != nil {
 | 
							if err != nil {
 | 
				
			||||||
			log.Println(err)
 | 
								log.Println(err)
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user