Skip to content

fix: treat an empty GRAPHICLE_DOCUMENT_HELPER as unset - #53

Open
leninworld wants to merge 1 commit into
Graphicle-AI:mainfrom
leninworld:fix-empty-document-helper
Open

leninworld wants to merge 1 commit into
Graphicle-AI:mainfrom
leninworld:fix-empty-document-helper

Conversation

@leninworld

Copy link
Copy Markdown
Contributor

Summary

  • documents::helper() read GRAPHICLE_DOCUMENT_HELPER with var_os(..).map(PathBuf::from).or_else(next to this program). A variable that was set but empty gave Some(""), so the fallback to the graphicle-document bundled next to the program was never tried, and the final is_absolute() && is_file() check then dropped "". The installed helper read as not installed: OCR and legacy formats (png, jpg, tiff, webp, rtf, doc) were refused, and the conversion id in a folder's freshness record lost +helper.
  • An empty value now counts as unset, the same rule as db::pgpass_path and codex_home. A set, non-empty value behaves as before (it is used if it is an absolute file, and there is no fallback otherwise). The lookup moved into a small helper_with(variable, program) so the test can pass both in, as pgpass_path takes its environment.

Not changed: a set but unusable path (relative, missing) still means no helper rather than the bundled one, as on main.

Test plan

  • New documents::tests::document_helper_treats_an_empty_variable_as_unset (temp folder with a fake program path, a bundled graphicle-document and a configured helper file) checks: unset and empty give the bundled helper; an existing absolute file gives that file; a missing, relative, whitespace-only or folder path gives none; empty with no bundled helper, and no program path, give none. With the empty-value filter removed it fails at the empty case (left: None, right: Some(".../graphicle-document")); with this change it passes.
  • cargo fmt --check, cargo clippy --locked --all-targets -- -D warnings, cargo clippy --locked --all-targets --features local-inference -- -D warnings and cargo test --locked --all-targets in crates/graphicle (lib 507 passed, it 566 passed / 3 ignored; Rust 1.95.0, macOS). Linux and Windows run in CI.

An empty variable stopped helper() from looking next to the program, so
the bundled graphicle-document read as not installed and OCR and legacy
formats were refused. Filter out an empty value before the fallback, as
db::pgpass_path and codex_home do.

Signed-off-by: Lenin Mookiah <2639584+leninworld@users.noreply.github.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant