MCPcopy
hub / github.com/codedogQBY/ReadAny / shouldDefaultToPathStyle

Function shouldDefaultToPathStyle

packages/core/src/sync/s3-backend.ts:144–155  ·  view source on GitHub ↗
(endpoint?: string)

Source from the content-addressed store, hash-verified

142 * the SDK default (virtual-hosted) for amazonaws.com.
143 */
144export 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
157export class S3Backend implements ISyncBackend {
158 readonly type = "s3" as const;

Callers 1

constructorMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected