( imageFiles: Map<string, File> | undefined, imageName: string )
| 91 | * Handles various path formats and case sensitivity issues. |
| 92 | */ |
| 93 | export function getImageFile( |
| 94 | imageFiles: Map<string, File> | undefined, |
| 95 | imageName: string |
| 96 | ): File | undefined { |
| 97 | if (!imageFiles || !imageName) { |
| 98 | return undefined; |
| 99 | } |
| 100 | |
| 101 | const normalizedName = normalizeImagePath(imageName); |
| 102 | const lookupKeys = getPreferredImageLookupKeys(normalizedName); |
| 103 | for (const key of lookupKeys) { |
| 104 | const match = imageFiles.get(key); |
| 105 | if (match) return match; |
| 106 | } |
| 107 | |
| 108 | return undefined; |
| 109 | } |
| 110 | |
| 111 | function getPreferredImageLookupKeys(normalizedName: string): string[] { |
| 112 | const keys: string[] = []; |
no test coverage detected