From a3b7239d057d1bbb424641760099af96d0065ffb Mon Sep 17 00:00:00 2001
From: Ken Kuang <sykuang.tw@gmail.com>
Date: Sun, 21 Apr 2024 03:28:19 +0800
Subject: [PATCH] Fix Cannot read properties of undefined (reading 'length')
 (#1145)

Fix upload failed
---
 collector/processSingleFile/convert/asPDF.js | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/collector/processSingleFile/convert/asPDF.js b/collector/processSingleFile/convert/asPDF.js
index e81fe6c76..458277754 100644
--- a/collector/processSingleFile/convert/asPDF.js
+++ b/collector/processSingleFile/convert/asPDF.js
@@ -22,7 +22,7 @@ async function asPDF({ fullFilePath = "", filename = "" }) {
         doc.metadata?.loc?.pageNumber || "unknown"
       } --`
     );
-    if (!doc.pageContent.length) continue;
+    if (!doc.pageContent || !doc.pageContent.length) continue;
     pageContent.push(doc.pageContent);
   }
 
-- 
GitLab