diff --git a/collector/processLink/convert/generic.js b/collector/processLink/convert/generic.js index 6af41f6c..f42dcd17 100644 --- a/collector/processLink/convert/generic.js +++ b/collector/processLink/convert/generic.js @@ -18,7 +18,7 @@ async function scrapeGenericUrl(link) { const url = new URL(link); const filename = (url.host + "-" + url.pathname).replace(".", "_"); - data = { + const data = { id: v4(), url: "file://" + slugify(filename) + ".html", title: slugify(filename) + ".html", diff --git a/collector/processSingleFile/convert/asAudio.js b/collector/processSingleFile/convert/asAudio.js index 97e958df..a15207fb 100644 --- a/collector/processSingleFile/convert/asAudio.js +++ b/collector/processSingleFile/convert/asAudio.js @@ -46,7 +46,7 @@ async function asAudio({ fullFilePath = "", filename = "" }) { return { success: false, reason: `No text content found in ${filename}.` }; } - data = { + const data = { id: v4(), url: "file://" + fullFilePath, title: filename, diff --git a/collector/processSingleFile/convert/asDocx.js b/collector/processSingleFile/convert/asDocx.js index 7c336865..7a64a042 100644 --- a/collector/processSingleFile/convert/asDocx.js +++ b/collector/processSingleFile/convert/asDocx.js @@ -28,7 +28,7 @@ async function asDocX({ fullFilePath = "", filename = "" }) { } const content = pageContent.join(""); - data = { + const data = { id: v4(), url: "file://" + fullFilePath, title: filename, diff --git a/collector/processSingleFile/convert/asMbox.js b/collector/processSingleFile/convert/asMbox.js index 58df98cd..30883f21 100644 --- a/collector/processSingleFile/convert/asMbox.js +++ b/collector/processSingleFile/convert/asMbox.js @@ -35,7 +35,7 @@ async function asMbox({ fullFilePath = "", filename = "" }) { `-- Working on message "${mail.subject || "Unknown subject"}" --` ); - data = { + const data = { id: v4(), url: "file://" + fullFilePath, title: mail?.subject diff --git a/collector/processSingleFile/convert/asOfficeMime.js b/collector/processSingleFile/convert/asOfficeMime.js index 49a96b8b..a6eb0351 100644 --- a/collector/processSingleFile/convert/asOfficeMime.js +++ b/collector/processSingleFile/convert/asOfficeMime.js @@ -23,7 +23,7 @@ async function asOfficeMime({ fullFilePath = "", filename = "" }) { return { success: false, reason: `No text content found in ${filename}.` }; } - data = { + const data = { id: v4(), url: "file://" + fullFilePath, title: filename, diff --git a/collector/processSingleFile/convert/asPDF.js b/collector/processSingleFile/convert/asPDF.js index 2509887e..ca433bf4 100644 --- a/collector/processSingleFile/convert/asPDF.js +++ b/collector/processSingleFile/convert/asPDF.js @@ -18,8 +18,7 @@ async function asPDF({ fullFilePath = "", filename = "" }) { const docs = await pdfLoader.load(); for (const doc of docs) { console.log( - `-- Parsing content from pg ${ - doc.metadata?.loc?.pageNumber || "unknown" + `-- Parsing content from pg ${doc.metadata?.loc?.pageNumber || "unknown" } --` ); if (!doc.pageContent.length) continue; @@ -33,7 +32,7 @@ async function asPDF({ fullFilePath = "", filename = "" }) { } const content = pageContent.join(""); - data = { + const data = { id: v4(), url: "file://" + fullFilePath, title: docs[0]?.metadata?.pdf?.info?.Title || filename, diff --git a/collector/processSingleFile/convert/asTxt.js b/collector/processSingleFile/convert/asTxt.js index 229c175e..ad35e547 100644 --- a/collector/processSingleFile/convert/asTxt.js +++ b/collector/processSingleFile/convert/asTxt.js @@ -23,7 +23,7 @@ async function asTxt({ fullFilePath = "", filename = "" }) { } console.log(`-- Working ${filename} --`); - data = { + const data = { id: v4(), url: "file://" + fullFilePath, title: filename, diff --git a/collector/processSingleFile/index.js b/collector/processSingleFile/index.js index 3884ca9b..37c9fd5c 100644 --- a/collector/processSingleFile/index.js +++ b/collector/processSingleFile/index.js @@ -5,8 +5,7 @@ const { SUPPORTED_FILETYPE_CONVERTERS, } = require("../utils/constants"); const { trashFile } = require("../utils/files"); - -RESERVED_FILES = ["__HOTDIR__.md"]; +const RESERVED_FILES = ["__HOTDIR__.md"]; async function processSingleFile(targetFilename) { const fullFilePath = path.resolve(WATCH_DIRECTORY, targetFilename);