fix: reject relative complete_dir/incomplete_dir in SABnzbd import - #67
Merged
Merged
Conversation
SABnzbd allows relative complete_dir/download_dir paths (resolved against its own working directory), but the import silently copied them verbatim into config.toml. rustnzb creates these directories eagerly at startup via create_dir_all, which resolves a relative path against the process's CWD instead of the intended download volume — producing a confusing crash far from the actual misconfiguration. Reported (and root-caused) by the #62 reporter after a SABnzbd import set their dirs to "Downloads" against a Docker volume at "/downloads". - h_setup_apply now rejects (400) non-absolute complete_dir/ incomplete_dir before touching config, so a broken import can never be persisted. - Both import parsers (INI + live API) now add a warning to the preview when either dir is relative, so the frontend's review-before-apply screen can flag it before the user even tries to apply. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Merged
thedancingdeveloper
added a commit
that referenced
this pull request
Aug 10, 2026
Ships the SABnzbd import path-validation fix (#67): relative complete_dir/incomplete_dir are now rejected at apply time instead of being silently persisted and crashing on next startup. Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
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
Follow-up to #62/#63. The reporter confirmed the diagnostics fix worked and found the actual root cause: importing their SABnzbd config set
complete_dir/incomplete_dirto a relative path ("Downloads") that didn't match their Docker volume mount (/downloads), reproducing the crash — see #62 (comment) and the follow-up root-cause writeup at #62 (comment).crates/nzb-core/src/sabnzbd_import.rsread SABnzbd'scomplete_dir/download_diras raw strings with no path validation, andapps/rustnzb/src/handlers.rs(h_setup_apply) wrote them straight into config via a barePathBuf::from(dir)— nois_absolute()check. A relative path gets silently persisted, thencreate_dir_allat startup resolves it against the process's CWD instead of the intended volume.Fix
h_setup_apply: reject (400 Bad Request) any non-absolutecomplete_dir/incomplete_dirbefore touching config — the actual safety net, so a broken import can never be persisted regardless of what the frontend does.warnings: Vec<String>list when either dir is relative, via a sharedwarn_relative_dirshelper — surfaces the problem on the review-before-apply screen, same UX pattern already used for masked passwords / unsupported scripts.Test plan
cargo test -p nzb-core --lib sabnzbd_import: new unit tests — relative dir → warning (INI + API parser), absolute dir → no warning (INI parser)cargo test -p rustnzb --test sabnzbd_import_apply_test: new integration tests callingh_setup_applydirectly — relativecomplete_dirrejected + config left untouched, relativeincomplete_dirrejected + config left untouched, absolute dirs applied successfullycargo test -p nzb-core --lib(118 passed),cargo test -p rustnzb --tests(all e2e/integration/unit)cargo fmt --check/cargo clippy --all-targets -- -D warningscleanCloses #62.
🤖 Generated with Claude Code