Skip to content

Supercharge your AI agents with data from the web and beyond. Building the library for superintelligence. 🔥

fix(api/native/pdf-parser): trim null chars out of pdf titles (#2086)

Gergő Móricz03c93396cfe6
diff --git a/apps/api/sharedLibs/pdf-parser/src/lib.rs b/apps/api/sharedLibs/pdf-parser/src/lib.rs
index 034723b98..b83262f4d 100644
--- a/apps/api/sharedLibs/pdf-parser/src/lib.rs
+++ b/apps/api/sharedLibs/pdf-parser/src/lib.rs
@@ -31,7 +31,8 @@ fn _get_pdf_metadata(path: &str) -> Result<PDFMetadata, String> {
.map(|s| String::from_utf8_lossy(s).to_string())
.ok()
)
- );
+ )
+ .map(|x| x.trim_matches(|x| char::is_whitespace(x) || x == '\0').to_string());
Ok(PDFMetadata { num_pages, title })
}