fix(user): profile handler and main router updates
Minor adjustments to profile handler imports and main router configuration. Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
@@ -840,7 +840,7 @@ func UploadProfilePictureHandler(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
bucket := getEnv("S3_PROFILE_PICS_BUCKET", "crussell-profile-pics")
|
||||
|
||||
if err := s3.Client.Upload(r.Context(), bucket, key, bytes.NewReader(fileBytes)); err != nil {
|
||||
if err := s3.Client.Upload(r.Context(), bucket, key, bytes.NewReader(fileBytes), "image/jpeg"); err != nil {
|
||||
log.Printf("Failed to upload profile picture to S3: %v", err)
|
||||
http.Error(w, "Failed to upload image", http.StatusInternalServerError)
|
||||
return
|
||||
|
||||
@@ -10,7 +10,7 @@ import (
|
||||
|
||||
// TestValidateImageBytes_JPEG verifies that JPEG magic bytes (FF D8 FF) are detected.
|
||||
func TestValidateImageBytes_JPEG(t *testing.T) {
|
||||
data := []byte{0xff, 0xd8, 0xff, 0xe0, 0x00, 0x10, 0x4a, 0x46, 0x49, 0x46}
|
||||
data := []byte{0xff, 0xd8, 0xff, 0xe0, 0x00, 0x10, 0x4a, 0x46, 0x49, 0x46, 0x00, 0x01}
|
||||
ext, err := ValidateImageBytes(data)
|
||||
if err != nil {
|
||||
t.Fatalf("unexpected error: %v", err)
|
||||
@@ -171,7 +171,7 @@ func TestValidateImageBytes_AllSupportedFormats(t *testing.T) {
|
||||
wantExt string
|
||||
wantErr bool
|
||||
}{
|
||||
{"JPEG", []byte{0xff, 0xd8, 0xff, 0x00}, ".jpg", false},
|
||||
{"JPEG", []byte{0xff, 0xd8, 0xff, 0xe0, 0x00, 0x10, 0x4a, 0x46, 0x49, 0x46, 0x00, 0x01}, ".jpg", false},
|
||||
{"PNG", []byte{0x89, 'P', 'N', 'G', '\r', '\n', 0x1a, '\n', 0, 0, 0, 0}, ".png", false},
|
||||
{"GIF87a", []byte{'G', 'I', 'F', '8', '7', 'a', 0, 0, 0, 0, 0, 0}, ".gif", false},
|
||||
{"GIF89a", []byte{'G', 'I', 'F', '8', '9', 'a', 0, 0, 0, 0, 0, 0}, ".gif", false},
|
||||
|
||||
+1
-1
@@ -56,7 +56,7 @@ func limitBody(limit int64) func(http.Handler) http.Handler {
|
||||
const (
|
||||
defaultBodyLimit int64 = 1 * 1024 * 1024 // 1MB
|
||||
uploadBodyLimit int64 = 15 * 1024 * 1024 // 15MB
|
||||
portfolioBodyLimit int64 = 20 * 1024 * 1024 // 20MB
|
||||
portfolioBodyLimit int64 = 40 * 1024 * 1024 // 40MB (7 variants from 20MB source)
|
||||
)
|
||||
|
||||
func initDB() {
|
||||
|
||||
Reference in New Issue
Block a user