Compare commits

..

No commits in common. "acae07b8f39e696253d9cb6ede0e7f42ff702aa7" and "1b100483de77c6c8cad1835accb2ffe3cd214400" have entirely different histories.

View File

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