Skip to content

fix(api): don't report the category folder for a missing release folder - #1054

Merged
javi11 merged 1 commit into
kipsilabs:mainfrom
firestaerter3:fix/history-missing-release-folder
Nov 11, 2026
Merged

javi11 merged 1 commit into
kipsilabs:mainfrom
firestaerter3:fix/history-missing-release-folder

Conversation

@firestaerter3

Copy link
Copy Markdown
Contributor

Follow-up to #1013 / #1019.

#1019 keeps an existing directory whose name ends in .h264, .nzb or .rNN as 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=history now reports storage as <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

  • calculateHistoryStoragePath strips 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.
  • This deliberately changes the "missing file keeps extension fallback" case: a missing Show/episode.mkv is now reported as Show/episode.mkv, not as Show. 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

  • New cases in sabnzbd_history_storage_test.go: existing folders ending in .h264, .r20 and .nzb are kept; an existing file still returns its folder; missing .h264 and .nzb paths are reported unchanged. The missing-path cases fail on main.
  • go vet and go test ./internal/api/ pass. No frontend changes.

This has run in our fork since 2026-10-17.

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>
@javi11
javi11 merged commit 23f094c into kipsilabs:main Nov 11, 2026
2 checks passed
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.

2 participants