Move Spaces FromEnv into blob; Upload takes Object; drop logSpaces.

This commit is contained in:
2026-08-21 23:48:18 -07:00
parent 3eb75cfd80
commit a36bc723cc
4 changed files with 45 additions and 39 deletions
+11 -5
View File
@@ -8,18 +8,19 @@ import (
"github.com/google/uuid"
"plumber/internal/blob"
"plumber/internal/geo"
"plumber/internal/store"
)
type profilePage struct {
page
States []struct{ Code, Name string }
Questions []store.RankedQuestion
States []struct{ Code, Name string }
Questions []store.RankedQuestion
QuestionsLabel string
UploadsEnabled bool
Error string
StateVal string
Error string
StateVal string
}
func (s *Server) handleProfileForm(w http.ResponseWriter, r *http.Request) {
@@ -74,7 +75,12 @@ func (s *Server) handleProfile(w http.ResponseWriter, r *http.Request) {
}
key := path.Join("avatars", u.ID, uuid.NewString()+ext)
limited := io.LimitReader(file, (2<<20)+1)
url, upErr := s.cfg.Blob.Upload(r.Context(), key, limited, contentType, hdr.Size)
url, upErr := s.cfg.Blob.Upload(r.Context(), blob.Object{
Key: key,
Body: limited,
ContentType: contentType,
Size: hdr.Size,
})
if upErr != nil {
s.renderProfile(w, r, u, "Could not upload avatar. Try again later.", state)
return