MCPcopy Index your code
hub / github.com/ColmapView/Colmapview.github.io / fetchUrlManifest

Function fetchUrlManifest

src/hooks/urlLoaderManifestFetch.ts:590–624  ·  view source on GitHub ↗
(
  manifestUrl: string,
  deps: FetchUrlManifestDeps
)

Source from the content-addressed store, hash-verified

588}
589
590export async function fetchUrlManifest(
591 manifestUrl: string,
592 deps: FetchUrlManifestDeps
593): Promise<ColmapManifest> {
594 const fetchImpl = deps.fetchImpl ?? defaultFetchUrl;
595 deps.setUrlProgress({ percent: 2, message: 'Fetching manifest...' });
596
597 const response = await fetchImpl(manifestUrl);
598
599 if (!response.ok) {
600 const errorType: UrlLoadErrorType = response.status === 404 ? 'not_found' : 'network';
601 const error: UrlLoadError = {
602 type: errorType,
603 message: `Failed to fetch manifest (${response.status})`,
604 details: response.statusText,
605 failedFile: manifestUrl,
606 };
607 throw error;
608 }
609
610 const data = await response.json();
611 const result = validateColmapManifest(data);
612 if (!result.success) {
613 const error: UrlLoadError = {
614 type: 'invalid_manifest',
615 message: 'Invalid manifest format',
616 details: result.details,
617 failedFile: manifestUrl,
618 };
619 throw error;
620 }
621
622 deps.setUrlProgress({ percent: 5, message: 'Manifest loaded' });
623 return result.manifest;
624}
625
626export async function fetchManifestFile(
627 baseUrl: string,

Callers 2

useUrlLoaderFunction · 0.90

Calls 1

validateColmapManifestFunction · 0.90

Tested by

no test coverage detected