(remoteRoot: string, path: string)
| 18 | } |
| 19 | |
| 20 | export function normalizeS3Key(remoteRoot: string, path: string): string { |
| 21 | const root = sanitizeS3RemoteRoot(remoteRoot) || DEFAULT_S3_REMOTE_ROOT; |
| 22 | let normalized = stripControlChars(path).trim().replace(/^\/+/, ""); |
| 23 | if (normalized === root || normalized.startsWith(`${root}/`)) { |
| 24 | return normalized; |
| 25 | } |
| 26 | normalized = normalized.replace(/^readany(?=\/|$)/, root); |
| 27 | if (normalized === root || normalized.startsWith(`${root}/`)) { |
| 28 | return normalized; |
| 29 | } |
| 30 | return `${root}/${normalized}`; |
| 31 | } |
| 32 | |
| 33 | export function s3KeyToLogicalPath(remoteRoot: string, key: string): string { |
| 34 | const root = sanitizeS3RemoteRoot(remoteRoot) || DEFAULT_S3_REMOTE_ROOT; |
no test coverage detected