From 009d717d806b681d14f50cd422f92bc61640ffb2 Mon Sep 17 00:00:00 2001 From: Jordan Knott Date: Fri, 11 Sep 2020 13:57:02 -0500 Subject: [PATCH] fix: uploading avatar image failing due to invalid UUID key fixes #55 --- internal/route/avatar.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/route/avatar.go b/internal/route/avatar.go index 9e06fbf..0e82436 100644 --- a/internal/route/avatar.go +++ b/internal/route/avatar.go @@ -14,6 +14,7 @@ import ( "github.com/jordanknott/taskcafe/internal/db" "github.com/jordanknott/taskcafe/internal/frontend" + "github.com/jordanknott/taskcafe/internal/utils" ) // Frontend serves the index.html file @@ -30,7 +31,7 @@ func (h *TaskcafeHandler) Frontend(w http.ResponseWriter, r *http.Request) { // ProfileImageUpload handles a user uploading a new avatar profile image func (h *TaskcafeHandler) ProfileImageUpload(w http.ResponseWriter, r *http.Request) { log.Info("preparing to upload file") - userID, ok := r.Context().Value("userID").(uuid.UUID) + userID, ok := r.Context().Value(utils.UserIDKey).(uuid.UUID) if !ok { log.Error("not a valid uuid") w.WriteHeader(http.StatusInternalServerError)