diff options
Diffstat (limited to 'system/admin')
-rw-r--r-- | system/admin/handlers.go | 5 | ||||
-rw-r--r-- | system/admin/upload/upload.go | 3 |
2 files changed, 8 insertions, 0 deletions
diff --git a/system/admin/handlers.go b/system/admin/handlers.go index c2d67e9..4f8ae83 100644 --- a/system/admin/handlers.go +++ b/system/admin/handlers.go @@ -114,6 +114,11 @@ func initHandler(res http.ResponseWriter, req *http.Request) { jwt.Secret([]byte(secret)) token, err := jwt.New(claims) + if err != nil { + log.Println(err) + res.WriteHeader(http.StatusInternalServerError) + return + } http.SetCookie(res, &http.Cookie{ Name: "_token", diff --git a/system/admin/upload/upload.go b/system/admin/upload/upload.go index 1a594f8..dbcdc17 100644 --- a/system/admin/upload/upload.go +++ b/system/admin/upload/upload.go @@ -51,6 +51,9 @@ func StoreFiles(req *http.Request) (map[string]string, error) { uploadDir := filepath.Join(pwd, uploadDirName, fmt.Sprintf("%d", tm.Year()), fmt.Sprintf("%02d", tm.Month())) err = os.MkdirAll(uploadDir, os.ModeDir|os.ModePerm) + if err != nil { + return nil, err + } // loop over all files and save them to disk for name, fds := range req.MultipartForm.File { |