From 95c2a9754403737e1c6a3b5e0ff0e22ff060db11 Mon Sep 17 00:00:00 2001 From: Steve Manuel Date: Mon, 17 Apr 2017 12:08:44 -0700 Subject: fix ineffassign and spelling errors --- system/admin/handlers.go | 5 +++++ system/admin/upload/upload.go | 3 +++ system/db/content.go | 2 +- 3 files changed, 9 insertions(+), 1 deletion(-) (limited to 'system') 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 { diff --git a/system/db/content.go b/system/db/content.go index b503a60..940c57b 100644 --- a/system/db/content.go +++ b/system/db/content.go @@ -253,7 +253,7 @@ func insert(ns string, data url.Values) (int, error) { } go func() { - // add data to seach index + // add data to search index target := fmt.Sprintf("%s:%s", ns, cid) err = search.UpdateIndex(target, j) if err != nil { -- cgit v1.2.3