* Resolve the request URL and display filename for an image. When an explicit * URL is given (a per-image mapping), it is used verbatim — already absolute and * encoded — and must not pass through buildImageUrl again. Otherwise the URL is * built from the base + COLMAP name. Returns null when nei
( imageUrlBase: string | null, imageName: string, explicitUrl?: string )
| 66 | * built from the base + COLMAP name. Returns null when neither is available. |
| 67 | */ |
| 68 | function resolveImageRequestUrl( |
| 69 | imageUrlBase: string | null, |
| 70 | imageName: string, |
| 71 | explicitUrl?: string |
| 72 | ): { url: string; filename: string } | null { |
| 73 | if (explicitUrl) { |
| 74 | return { url: explicitUrl, filename: getFilenameFromUrl(explicitUrl) }; |
| 75 | } |
| 76 | if (!imageUrlBase) { |
| 77 | return null; |
| 78 | } |
| 79 | return buildImageUrl(imageUrlBase, imageName); |
| 80 | } |
| 81 | |
| 82 | /** |
| 83 | * Fetch an image from URL and cache it. |
no test coverage detected