check-links: allow 403 from github user-attachments CDN

This commit is contained in:
Felix Rieseberg
2026-04-11 09:31:38 -07:00
parent 1bef3cce62
commit 3eab26fed1

View File

@@ -15,9 +15,13 @@ async function main() {
const response = await fetch(link, { method: 'HEAD' }) const response = await fetch(link, { method: 'HEAD' })
if (!response.ok) { if (!response.ok) {
// If we're inside GitHub's release asset server, we just ran into AWS not allowing // GitHub's release-asset and user-attachments CDNs reject anonymous HEAD
// HEAD requests, which is different from a 404. // requests (403), which is different from a 404.
if (!response.url.startsWith('https://github-production-release-asset')) { const isGithubCdn =
response.url.startsWith('https://github-production-release-asset') ||
response.url.startsWith('https://github-production-user-asset') ||
link.startsWith('https://github.com/user-attachments/')
if (!isGithubCdn) {
throw new Error (`HTTP Error Response: ${response.status} ${response.statusText}`) throw new Error (`HTTP Error Response: ${response.status} ${response.statusText}`)
} }
} }