(imageUrlBase: string, imageName: string)
| 126 | } |
| 127 | |
| 128 | export function buildImageUrl(imageUrlBase: string, imageName: string): UrlCandidate { |
| 129 | let normalizedName = normalizeImagePath(imageName); |
| 130 | |
| 131 | const urlBaseLower = imageUrlBase.toLowerCase(); |
| 132 | const nameLower = normalizedName.toLowerCase(); |
| 133 | if (urlBaseLower.endsWith('/images/') && nameLower.startsWith('images/')) { |
| 134 | normalizedName = normalizedName.slice(7); |
| 135 | } |
| 136 | |
| 137 | const url = imageUrlBase.endsWith('/') |
| 138 | ? `${imageUrlBase}${normalizedName}` |
| 139 | : `${imageUrlBase}/${normalizedName}`; |
| 140 | const filename = normalizedName.split('/').pop() || normalizedName; |
| 141 | |
| 142 | return { url, filename }; |
| 143 | } |
| 144 | |
| 145 | export function getMaskLookupPaths(imageName: string): string[] { |
| 146 | const normalized = normalizeImagePath(imageName); |
no test coverage detected