| 142 | * the SDK default (virtual-hosted) for amazonaws.com. |
| 143 | */ |
| 144 | export function shouldDefaultToPathStyle(endpoint?: string): boolean { |
| 145 | if (!endpoint) return false; // SDK default endpoints (real AWS S3) |
| 146 | try { |
| 147 | const url = new URL(endpoint); |
| 148 | const host = url.hostname.toLowerCase(); |
| 149 | if (host.endsWith("amazonaws.com")) return false; |
| 150 | return true; |
| 151 | } catch { |
| 152 | // Endpoint string that doesn't parse as a URL → assume self-hosted. |
| 153 | return true; |
| 154 | } |
| 155 | } |
| 156 | |
| 157 | export class S3Backend implements ISyncBackend { |
| 158 | readonly type = "s3" as const; |