( imageName: string, index: Map<string, ArchiveEntry> )
| 70 | * Find an entry in a ZIP index by image name. |
| 71 | */ |
| 72 | export function findZipEntry( |
| 73 | imageName: string, |
| 74 | index: Map<string, ArchiveEntry> |
| 75 | ): ArchiveEntry | null { |
| 76 | const candidates = getZipEntryLookupCandidates(imageName); |
| 77 | |
| 78 | for (const candidate of candidates) { |
| 79 | const entry = index.get(candidate); |
| 80 | if (entry) { |
| 81 | return entry; |
| 82 | } |
| 83 | } |
| 84 | |
| 85 | const lowerCandidates = new Set(candidates.map(candidate => candidate.toLowerCase())); |
| 86 | for (const [key, entry] of index.entries()) { |
| 87 | if (lowerCandidates.has(key.toLowerCase())) { |
| 88 | return entry; |
| 89 | } |
| 90 | } |
| 91 | |
| 92 | return null; |
| 93 | } |
| 94 | |
| 95 | /** |
| 96 | * Extract an image from the active ZIP archive. |
no test coverage detected