fix(library): a destination equal to a configured root plans the book folder instead of claiming the root - #915
Open
kevinheneveld wants to merge 2 commits into
Conversation
… folder instead of claiming the root Adding with DestinationPath set to a configured root folder persisted the root itself as the audiobook's BasePath. That has two failure modes: the destination mutation guard then rejects every later add aimed at that root (destination_path_blocked — 'already assigned to another audiobook'), so one such record poisons all root-destined adds; and when the record's download eventually imports, its files land loose in the library root. Treat a root-equal destination as a root selection: plan the book's folder under the chosen root with the folder naming pattern, exactly as an omitted destination plans it under the default root. Destinations already inside a root are unchanged. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
kevinheneveld
added a commit
to kevinheneveld/Listenarr
that referenced
this pull request
Aug 31, 2026
… folder (PR Listenarrs#915) Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…, not legacy host-path helpers FileUtils.IsPathSameOrInside/IsPathInsideOf are on the architecture test's forbidden list (LegacyHostPathIdentity_StaysOnExplicitAllowList); compare canonical spellings via FileSystemPathIdentity instead — conservative for the root-selection rewrite, since the selection arrives as the root's stored path. Co-Authored-By: Claude Fable 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.
The bug
LibraryAddServicepersists a providedDestinationPathverbatim as the audiobook'sBasePath. When a client passes the root folder path itself ("put it under this root" — my series bulk-add UI does, and any API caller can), the record ends up withBasePath = <root>. Two failure modes:destination_path_blocked. On my instance 102 wishlist records had accumulatedBasePath = /audiobooks, at which point bulk-adding an entire series failed 100% (that's how I found it).BasePath= the root — 10 of my records had scattered ~330 loose files at the top of the library before the guard started blocking.The fix
Treat a destination that is a configured root as a root selection: plan the book folder under the chosen root with
FolderNamingPattern, exactly as an omitted destination plans one under the default root. Destinations already inside a root are unchanged.Regression test: add with
DestinationPath = <configured root>asserts the persistedBasePathis the planned{Author}folder under the root, not the root.🤖 Generated with Claude Code