(filePath: string, cwd: string, rootDir?: string)
| 159 | } |
| 160 | |
| 161 | function resolveLocalPath(filePath: string, cwd: string, rootDir?: string): string { |
| 162 | const resolvedPath = path.isAbsolute(filePath) ? filePath : path.resolve(cwd, filePath); |
| 163 | if (rootDir && !isPathInside(resolvedPath, rootDir)) { |
| 164 | throw new AppError('INVALID_ARGS', 'Local path is outside the artifact adapter root', { |
| 165 | path: resolvedPath, |
| 166 | rootDir, |
| 167 | }); |
| 168 | } |
| 169 | return resolvedPath; |
| 170 | } |
| 171 | |
| 172 | function isPathInside(filePath: string, rootDir: string): boolean { |
| 173 | const relative = path.relative(rootDir, filePath); |
no test coverage detected