( archivePath: string, desiredExtension: string, acceptedExtensions: string[] = [desiredExtension], )
| 193 | } |
| 194 | |
| 195 | function normalizeArchiveExtension( |
| 196 | archivePath: string, |
| 197 | desiredExtension: string, |
| 198 | acceptedExtensions: string[] = [desiredExtension], |
| 199 | ): string { |
| 200 | const loweredPath = archivePath.toLowerCase(); |
| 201 | if (acceptedExtensions.some((extension) => loweredPath.endsWith(extension))) { |
| 202 | return archivePath; |
| 203 | } |
| 204 | const normalizedPath = `${archivePath}${desiredExtension}`; |
| 205 | try { |
| 206 | fs.renameSync(archivePath, normalizedPath); |
| 207 | return normalizedPath; |
| 208 | } catch (error) { |
| 209 | throw new AppError( |
| 210 | 'COMMAND_FAILED', |
| 211 | `Failed to normalize artifact path to ${desiredExtension}`, |
| 212 | { |
| 213 | from: archivePath, |
| 214 | to: normalizedPath, |
| 215 | }, |
| 216 | error instanceof Error ? error : undefined, |
| 217 | ); |
| 218 | } |
| 219 | } |
| 220 | |
| 221 | function isTarLikePath(filePath: string): boolean { |
| 222 | const lowered = filePath.toLowerCase(); |
no outgoing calls
no test coverage detected
searching dependent graphs…