Repository navigation
fix: treat an empty GRAPHICLE_DOCUMENT_HELPER as unset - #53
Open
leninworld wants to merge 1 commit into
Open
leninworld wants to merge 1 commit into
leninworld wants to merge 1 commit into
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
documents::helper()readGRAPHICLE_DOCUMENT_HELPERwithvar_os(..).map(PathBuf::from).or_else(next to this program). A variable that was set but empty gaveSome(""), so the fallback to thegraphicle-documentbundled next to the program was never tried, and the finalis_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.db::pgpass_pathandcodex_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 smallhelper_with(variable, program)so the test can pass both in, aspgpass_pathtakes 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
documents::tests::document_helper_treats_an_empty_variable_as_unset(temp folder with a fake program path, a bundledgraphicle-documentand 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 warningsandcargo test --locked --all-targetsincrates/graphicle(lib 507 passed, it 566 passed / 3 ignored; Rust 1.95.0, macOS). Linux and Windows run in CI.