From 8e7a65c79a69ec65b0d7965aef2da98f7e82bdf4 Mon Sep 17 00:00:00 2001 From: TheFlow Date: Sun, 22 Feb 2026 17:25:43 +1300 Subject: [PATCH] fix: Remove broken PDF download fallback, use explicit download_formats The sidebar download button was assuming every document had a PDF at /downloads/{slug}.pdf, causing 404s for 70 documents where the slug didn't match a file (or no PDF existed). Now only shows download buttons when download_formats.pdf is explicitly set in MongoDB. Corresponding migration populated download_formats.pdf for 72 documents that have actual PDF files on disk. Co-Authored-By: Claude Opus 4.6 --- public/js/docs-app.js | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/public/js/docs-app.js b/public/js/docs-app.js index 89af846d..8da5f9bb 100644 --- a/public/js/docs-app.js +++ b/public/js/docs-app.js @@ -506,14 +506,6 @@ function renderDocLink(doc, isHighlighted = false) { if (doc.download_formats && doc.download_formats.pdf) { pdfPath = doc.download_formats.pdf; hasPDF = true; - } else if (!doc.slug.includes('api-reference-complete') && - !doc.slug.includes('openapi-specification') && - !doc.slug.includes('api-javascript-examples') && - !doc.slug.includes('api-python-examples') && - !doc.slug.includes('technical-architecture-diagram')) { - // Fallback to default /downloads/ path for documents that typically have PDFs - pdfPath = `/downloads/${doc.slug}.pdf`; - hasPDF = true; } // Add download button styling @@ -963,13 +955,6 @@ async function loadDocument(slug, lang = null) { if (currentDocument.download_formats && currentDocument.download_formats.pdf) { pdfPath = currentDocument.download_formats.pdf; hasPDF = true; - } else if (!currentDocument.slug.includes('api-reference-complete') && - !currentDocument.slug.includes('openapi-specification') && - !currentDocument.slug.includes('api-javascript-examples') && - !currentDocument.slug.includes('api-python-examples') && - !currentDocument.slug.includes('technical-architecture-diagram')) { - pdfPath = `/downloads/${currentDocument.slug}.pdf`; - hasPDF = true; } let headerHTML = `