From 92193fe1bc0d475ac2baa4e28dab2fe838fdf590 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sun, 25 Aug 2024 20:25:04 -0700 Subject: [PATCH] fix(deps): update rust crate lopdf to 0.33.0 and pdf_extract to v0.7.8 (#206) * fix(deps): update rust crate lopdf to 0.33.0 * updat pdf_extract to v0.7.8 --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Prabir Shrestha --- Cargo.toml | 4 ++-- src/document_loaders/error.rs | 6 +++++- src/document_loaders/pdf_loader/pdf_extract_loader.rs | 6 +++--- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 8a13a034..83626e02 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -42,8 +42,8 @@ text-splitter = { version = "0.15", features = ["tiktoken-rs", "markdown"] } surrealdb = { version = "1.4.2", optional = true, default-features = false } csv = "1.3.0" urlencoding = "2.1.3" -lopdf = { version = "0.32.0", features = ["nom_parser"], optional = true } -pdf-extract = { version = "0.7.7", optional = true } +lopdf = { version = "0.33.0", features = ["nom_parser"], optional = true } +pdf-extract = { version = "0.7.8", optional = true } thiserror = "1.0.59" futures-util = "0.3.30" async-stream = "0.3.5" diff --git a/src/document_loaders/error.rs b/src/document_loaders/error.rs index dcaa7d0a..a5ca4e05 100644 --- a/src/document_loaders/error.rs +++ b/src/document_loaders/error.rs @@ -21,10 +21,14 @@ pub enum LoaderError { #[error(transparent)] CSVError(#[from] csv::Error), - #[cfg(feature = "lopdf")] + #[cfg(any(feature = "lopdf"))] #[error(transparent)] LoPdfError(#[from] lopdf::Error), + #[cfg(feature = "pdf-extract")] + #[error(transparent)] + PdfExtractError(#[from] pdf_extract::Error), + #[cfg(feature = "pdf-extract")] #[error(transparent)] PdfExtractOutputError(#[from] pdf_extract::OutputError), diff --git a/src/document_loaders/pdf_loader/pdf_extract_loader.rs b/src/document_loaders/pdf_loader/pdf_extract_loader.rs index fa99428d..c88bbde0 100644 --- a/src/document_loaders/pdf_loader/pdf_extract_loader.rs +++ b/src/document_loaders/pdf_loader/pdf_extract_loader.rs @@ -13,7 +13,7 @@ use crate::{ #[derive(Debug, Clone)] pub struct PdfExtractLoader { - document: lopdf::Document, + document: pdf_extract::Document, } impl PdfExtractLoader { @@ -29,7 +29,7 @@ impl PdfExtractLoader { /// ``` /// pub fn new(reader: R) -> Result { - let document = lopdf::Document::load_from(reader)?; + let document = pdf_extract::Document::load_from(reader)?; Ok(Self { document }) } /// Creates a new PdfLoader from a path to a PDF file. @@ -42,7 +42,7 @@ impl PdfExtractLoader { /// ``` /// pub fn from_path>(path: P) -> Result { - let document = lopdf::Document::load(path)?; + let document = pdf_extract::Document::load(path)?; Ok(Self { document }) } }