(url: string)
| 51 | * Pre-signed URLs should not be normalized as they already contain authentication. |
| 52 | */ |
| 53 | export 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. |
no outgoing calls
no test coverage detected