feat(ingestion): take the record from the metadata of the file #86
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "feat/78-file-metadata"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #78
Was based on #85 (merged): now targets
develop.Change
src/instance/file-metadata.ts—readFileMetadata(content, contentType):title,description/summary,author(s)/creator(s),publisher,date/year,lang/language,isbn,doi), else the first#heading;<title>,citation_*anddescription/author/og:*meta tags,<html lang>;;, Subject, CreationDate), placeholder titles left out ("Microsoft Word - …", "untitled");docProps/core.xml, ODTmeta.xml, EPUB OPF (throughMETA-INF/container.xml, ISBN/DOI fromdc:identifier), read withfflate(already a dependency), packages above 50 MB skipped;Bug fixed on the way: small PDFs read as another file
pdf.js (inside
pdf-parse) copies its input withnew value.constructor(value). For aBuffer, that copy lands in Node's shared pool of small buffers, at an offset pdf.js ignores: it then parses whatever else is in the pool ("bad XRef entry", "Command token too long"). Small originals (under 4 KB) could fail to extract depending on what was allocated before.pdfBytes()hands it a plainUint8Array; used for text extraction and metadata. Regression test with a PDF at a non-zero pool offset (fails without the fix).Checks
yarn test272/272: one test per format, fallbacks, the pooled PDF, hints in the prompt, ingestion without a model (frontmatter → title, description, language, creators, publisher, year) and with a failing model (first heading).🤖 Generated with Claude Code