MCPcopy Create free account
hub / github.com/ColmapView/Colmapview.github.io / resolveImageRequestUrl

Function resolveImageRequestUrl

src/utils/urlImageFiles.ts:68–80  ·  view source on GitHub ↗

* 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
)

Source from the content-addressed store, hash-verified

66 * built from the base + COLMAP name. Returns null when neither is available.
67 */
68function 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.

Callers 2

fetchUrlImageFunction · 0.85
fetchUrlImageRawFunction · 0.85

Calls 2

getFilenameFromUrlFunction · 0.90
buildImageUrlFunction · 0.90

Tested by

no test coverage detected