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

Function isPreSignedUrl

src/utils/urlCloudStorage.ts:53–78  ·  view source on GitHub ↗
(url: string)

Source from the content-addressed store, hash-verified

51 * Pre-signed URLs should not be normalized as they already contain authentication.
52 */
53export function isPreSignedUrl(url: string): boolean {
54 try {
55 const parsed = new URL(url);
56 const params = parsed.searchParams;
57
58 // AWS S3 pre-signed URL parameters
59 if (params.has('X-Amz-Signature') || params.has('Signature')) {
60 return true;
61 }
62
63 // GCS pre-signed URL parameters
64 if (params.has('X-Goog-Signature') || params.has('Signature')) {
65 return true;
66 }
67
68 // R2 uses the same signature format as S3
69 // Generic signed URL indicators
70 if (params.has('token') || params.has('sig') || params.has('signature')) {
71 return true;
72 }
73
74 return false;
75 } catch {
76 return false;
77 }
78}
79
80/**
81 * Normalize cloud storage URIs and console URLs to direct HTTPS URLs.

Callers 3

normalizeCloudStorageUrlFunction · 0.85
urlUtils.test.tsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected