rafmacalaba commited on
Commit
b72d00c
·
1 Parent(s): c26d381

fix: remove PDF HEAD check that was filtering out valid docs (WB returns 301 for HEAD)

Browse files
Files changed (1) hide show
  1. app/api/documents/route.js +1 -18
app/api/documents/route.js CHANGED
@@ -43,25 +43,8 @@ export async function GET() {
43
 
44
  if (annotatablePages.length === 0) return null;
45
 
46
- // Validate PDF URL is reachable
47
  const pdfUrl = link.direct_pdf_url;
48
- if (pdfUrl) {
49
- try {
50
- const pdfCheck = await fetch(pdfUrl, {
51
- method: 'HEAD',
52
- signal: AbortSignal.timeout(5000),
53
- });
54
- if (!pdfCheck.ok) {
55
- console.log(`Skipping doc_${link.index}: PDF returned ${pdfCheck.status}`);
56
- return null;
57
- }
58
- } catch (e) {
59
- console.log(`Skipping doc_${link.index}: PDF unreachable (${e.message})`);
60
- return null;
61
- }
62
- } else {
63
- return null; // no PDF URL at all
64
- }
65
 
66
  return {
67
  index: link.index,
 
43
 
44
  if (annotatablePages.length === 0) return null;
45
 
 
46
  const pdfUrl = link.direct_pdf_url;
47
+ if (!pdfUrl) return null; // no PDF URL at all
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
48
 
49
  return {
50
  index: link.index,