Skip to content

A fast, helpful, and open-source document parser

fix windows paths for libreoffice conversion

Logan Markewichda74012713ef
diff --git a/Cargo.lock b/Cargo.lock
index 924788c..9b53eb6 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -1221,6 +1221,7 @@ dependencies = [
"tesseract-rs",
"thiserror 2.0.18",
"tokio",
+ "url",
"web-time",
]
diff --git a/crates/liteparse/Cargo.toml b/crates/liteparse/Cargo.toml
index 03377dd..adf0621 100644
--- a/crates/liteparse/Cargo.toml
+++ b/crates/liteparse/Cargo.toml
@@ -32,6 +32,7 @@ tempfile = "3.27.0"
thiserror = "2"
tesseract-rs = { version = "0.2", features = ["build-tesseract"], optional = true }
tokio = { version = "1.52.3", features = ["rt", "macros", "sync", "time", "io-util"] }
+url = "2"
web-time = "1.1.0"
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
diff --git a/crates/liteparse/src/conversion.rs b/crates/liteparse/src/conversion.rs
index c3df1a4..e6e83d5 100644
--- a/crates/liteparse/src/conversion.rs
+++ b/crates/liteparse/src/conversion.rs
@@ -419,10 +419,14 @@ pub async fn convert_office_document(
let user_profile_dir = tempfile::Builder::new()
.prefix("liteparse-lo-profile-")
.tempdir()?;
- let user_profile_url = format!(
- "-env:UserInstallation=file://{}",
- user_profile_dir.path().to_string_lossy()
- );
+ let user_profile_file_url =
+ url::Url::from_file_path(user_profile_dir.path()).map_err(|_| {
+ LiteParseError::Conversion(format!(
+ "failed to convert temp profile path to file URL: {}",
+ user_profile_dir.path().display()
+ ))
+ })?;
+ let user_profile_url = format!("-env:UserInstallation={user_profile_file_url}");
let infilter_arg;
let mut args: Vec<&str> = vec![
&user_profile_url,