-
-
Notifications
You must be signed in to change notification settings - Fork 177
Profile Image Upload System #409
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
f183adf
6e0394d
5067d6a
d900ecf
4ba4d57
19a021f
7a93065
72ae5cb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,4 +2,4 @@ | |
| *.log | ||
| *.env | ||
| config.prod.yml | ||
| vite.config.ts.timestamp-*.mjs | ||
| vite.config.ts.timestamp-*.mjs | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| package config | ||
|
|
||
| import "testing" | ||
|
|
||
| func TestS3ConfigEndpointState(t *testing.T) { | ||
| tests := []struct { | ||
| name string | ||
| config S3Config | ||
| hasEndpointConfig bool | ||
| isConfigured bool | ||
| }{ | ||
| {name: "empty", config: S3Config{}, hasEndpointConfig: false, isConfigured: false}, | ||
| {name: "region only", config: S3Config{Region: "us-east-1"}, hasEndpointConfig: true, isConfigured: false}, | ||
| {name: "bucket only", config: S3Config{Bucket: "avatar-bucket"}, hasEndpointConfig: true, isConfigured: false}, | ||
| { | ||
| name: "complete", | ||
| config: S3Config{Region: "us-east-1", Bucket: "avatar-bucket"}, | ||
| hasEndpointConfig: true, | ||
| isConfigured: true, | ||
| }, | ||
| } | ||
|
|
||
| for _, test := range tests { | ||
| t.Run(test.name, func(t *testing.T) { | ||
| if got := test.config.HasEndpointConfig(); got != test.hasEndpointConfig { | ||
| t.Fatalf("HasEndpointConfig() = %v, want %v", got, test.hasEndpointConfig) | ||
| } | ||
| if got := test.config.IsConfigured(); got != test.isConfigured { | ||
| t.Fatalf("IsConfigured() = %v, want %v", got, test.isConfigured) | ||
| } | ||
| }) | ||
| } | ||
| } | ||
|
Comment on lines
+5
to
+33
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win Cover the new configuration branches before this lands. The test currently verifies only 🤖 Prompt for AI Agents |
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
Reject every partial S3 configuration.
Line 68 only treats a non-empty bucket as endpoint configuration. A config with
s3.regionset and nos3.bucketstarts successfully and disables avatar uploads. Treat either field as S3 configuration, then fail startup whenIsConfigured()is false, mate.Proposed fix
func (c S3Config) HasEndpointConfig() bool { - return c.Bucket != "" + return c.Region != "" || c.Bucket != "" }🤖 Prompt for AI Agents