(remoteRoot: string, key: string)
| 31 | } |
| 32 | |
| 33 | export function s3KeyToLogicalPath(remoteRoot: string, key: string): string { |
| 34 | const root = sanitizeS3RemoteRoot(remoteRoot) || DEFAULT_S3_REMOTE_ROOT; |
| 35 | const normalizedKey = key.replace(/\/+$/, ""); |
| 36 | if (normalizedKey === root) return "/readany"; |
| 37 | if (normalizedKey.startsWith(`${root}/`)) { |
| 38 | return `/readany/${normalizedKey.slice(root.length + 1)}`; |
| 39 | } |
| 40 | return `/${normalizedKey}`; |
| 41 | } |
no test coverage detected