/** * 根据 CDN 加速域名与对象 key 拼接完整的访问地址。 * @param cdnBaseUrl CDN 根地址(如 https://cdn.example.com),可带或不带末尾斜杠 * @param key 对象在桶内的 key(如 basePrefix/path/file.js) * @returns 完整访问 URL,如 https://cdn.example.com/basePrefix/path/file.js */ export function buildCdnAccessUrl(cdnBaseUrl: string, key: string): string { const base = cdnBaseUrl.replace(/\/+$/, ''); const pathPart = key.replace(/^\/+/, ''); return pathPart ? `${base}/${pathPart}` : base; }