Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.
Go
Prefer CDN domain over raw endpoint URL in attachment links (#1300)
Matthew Lal965bf731abbe
diff --git a/server/internal/storage/s3.go b/server/internal/storage/s3.goindex 80d498bdcb..22d10e1713 100644--- a/server/internal/storage/s3.go+++ b/server/internal/storage/s3.go@@ -158,14 +158,18 @@ func (s *S3Storage) Upload(ctx context.Context, key string, data []byte, contentreturn "", fmt.Errorf("s3 PutObject: %w", err)}+ // Prefer the configured CDN/public-read domain when set. This allows S3-compatible+ // backends (MinIO, R2, B2, Wasabi, etc.) to be paired with a separate public domain+ // for reads — the custom endpoint is still used for writes via the SDK, but the URL+ // stored for client consumption points at the reader-facing domain.+ if s.cdnDomain != "" {+ link := fmt.Sprintf("https://%s/%s", s.cdnDomain, key)+ return link, nil+ }if s.endpointURL != "" {link := fmt.Sprintf("%s/%s/%s", strings.TrimRight(s.endpointURL, "/"), s.bucket, key)return link, nil}- domain := s.bucket- if s.cdnDomain != "" {- domain = s.cdnDomain- }- link := fmt.Sprintf("https://%s/%s", domain, key)+ link := fmt.Sprintf("https://%s/%s", s.bucket, key)return link, nil}