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

Function buildImageUrl

src/utils/imageFileLookupPolicy.ts:128–143  ·  view source on GitHub ↗
(imageUrlBase: string, imageName: string)

Source from the content-addressed store, hash-verified

126}
127
128export 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
145export function getMaskLookupPaths(imageName: string): string[] {
146 const normalized = normalizeImagePath(imageName);

Callers 2

resolveImageRequestUrlFunction · 0.90

Calls 1

normalizeImagePathFunction · 0.85

Tested by

no test coverage detected