mirror of
https://github.com/multica-ai/multica.git
synced 2026-07-16 14:49:09 +02:00
* fix(storage): support custom S3 endpoints for self-hosted deployments When AWS_ENDPOINT_URL is set, the S3 client now uses path-style addressing and routes requests to the custom endpoint (e.g. MinIO). Returns path-style URLs (endpoint/bucket/key) instead of virtual-hosted URLs so attachments are accessible on local setups. Also falls back to STANDARD storage class for custom endpoints since MinIO and other S3-compatible stores do not support INTELLIGENT_TIERING. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * fix(storage): handle custom endpoint URLs in KeyFromURL --------- Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
30 lines
814 B
Go
30 lines
814 B
Go
package storage
|
|
|
|
import "testing"
|
|
|
|
func TestS3StorageKeyFromURL_CustomEndpointPreservesNestedKey(t *testing.T) {
|
|
s := &S3Storage{
|
|
bucket: "test-bucket",
|
|
endpointURL: "http://localhost:9000",
|
|
}
|
|
|
|
rawURL := "http://localhost:9000/test-bucket/uploads/abc/file.png"
|
|
|
|
if got := s.KeyFromURL(rawURL); got != "uploads/abc/file.png" {
|
|
t.Fatalf("KeyFromURL(%q) = %q, want %q", rawURL, got, "uploads/abc/file.png")
|
|
}
|
|
}
|
|
|
|
func TestS3StorageKeyFromURL_CustomEndpointWithTrailingSlash(t *testing.T) {
|
|
s := &S3Storage{
|
|
bucket: "test-bucket",
|
|
endpointURL: "http://localhost:9000/",
|
|
}
|
|
|
|
rawURL := "http://localhost:9000/test-bucket/uploads/abc/file.png"
|
|
|
|
if got := s.KeyFromURL(rawURL); got != "uploads/abc/file.png" {
|
|
t.Fatalf("KeyFromURL(%q) = %q, want %q", rawURL, got, "uploads/abc/file.png")
|
|
}
|
|
}
|