Repository navigation
fix(api): don't report the category folder for a missing release folder - #1054
Merged
javi11 merged 1 commit intoNov 11, 2026
Merged
Conversation
kipsilabs#1019 stopped stripping the last component of an existing directory whose name ends in an extension (.h264, .nzb, .rNN). For a path that does not exist it still strips, on purpose, so a missing release folder named like that is reported in the SABnzbd history as its parent: the category folder. A category folder reported as storage is what started kipsilabs#1029. The arr takes it as the download's output path, scans every release in it, and with "remove from client" deletes it through the mount. Strip the last component only when the path is an existing regular file. A missing path is reported as it is, so the arr fails the import with "path does not exist" instead of working on the whole category. Co-Authored-By: Claude Opus 5.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.
Follow-up to #1013 / #1019.
#1019 keeps an existing directory whose name ends in
.h264,.nzbor.rNNas it is. For a path that does not exist, it still strips the last component on purpose (the "missing file keeps extension fallback" test). So a release folder named like that, once it is gone, is reported in the SABnzbd history as its parent: the category folder.That is the same outcome #1013 was about, and a category folder reported as storage is what started #1029. The arr takes the category folder as the download's output path and scans every release in it. With "remove from client" it deletes that folder through the mount.
How to reproduce: complete a job whose release folder is named e.g.
Some.Show.S01.1080p.h264, then remove that folder (or its metadata).mode=historynow reportsstorageas<mount>/complete/<category>. In our case, with the same change as #1019 applied, 9 completed jobs still reported the category folder this way, all with a missing folder (6 ending in.nzb, 2 in.r20, 1 in.h264), and one of them sat in Sonarr's queue.Changes
calculateHistoryStoragePathstrips the last component only when the path is an existing regular file. A missing path is reported as it is, so the arr fails the import with "path does not exist" instead of working on the whole category.Show/episode.mkvis now reported asShow/episode.mkv, not asShow. A missing path cannot be told apart as file or folder, and guessing "file" is what hands out the category folder. If you'd rather keep the fallback for files, a narrower option is to strip a missing path only when the result is not the category folder itself. Happy to change it to that.Testing
sabnzbd_history_storage_test.go: existing folders ending in.h264,.r20and.nzbare kept; an existing file still returns its folder; missing.h264and.nzbpaths are reported unchanged. The missing-path cases fail on main.go vetandgo test ./internal/api/pass. No frontend changes.This has run in our fork since 2026-10-17.