Skip to content

fix(importer): correctly strip .nzb and .nzb.gz extensions from release names#524

Merged
javi11 merged 6 commits intojavi11:mainfrom
drondeseries:fix/nzb-gz-extension-duplication
Apr 22, 2026
Merged

fix(importer): correctly strip .nzb and .nzb.gz extensions from release names#524
javi11 merged 6 commits intojavi11:mainfrom
drondeseries:fix/nzb-gz-extension-duplication

Conversation

@drondeseries
Copy link
Copy Markdown
Contributor

Description

This PR fixes an issue where the .nzb extension was being included in virtual directory names and symlink filenames (e.g., Movie.nzb/Movie.nzb.mkv).

Root Cause

The issue was introduced in commit 23bfde95 when transparent NZB compression (.nzb.gz) was added to persistent storage. The existing codebase relied on filepath.Ext() to strip extensions. However, filepath.Ext() only identifies the final extension (.gz), leaving the .nzb part intact.

Changes

  • Introduced a centralized, dependency-free utility package internal/importer/utils/nzbtrim.
  • Implemented TrimNzbExtension to handle case-insensitive removal of both .nzb and .nzb.gz.
  • Refactored all occurrences of filepath.Ext and strings.TrimSuffix(..., ".nzb") in the import and API logic to use this new utility.

Impacted Areas

  • Virtual File System: Folder naming in internal/importer/filesystem/utils.go.
  • Processors: Single-file, multi-file, RAR, and 7zip release name derivation.
  • API: Stremio handler (nzb_stremio_handlers.go) now generates clean stream names.
  • Service: Persistence and metadata regeneration logic in service.go.

Verification

  • Verified with reproduction tests ensuring file.nzb.gz and file.NZB both resolve to file.
  • Confirmed no regression in existing importer test suites.

@lostgit
Copy link
Copy Markdown

lostgit commented Apr 21, 2026

altmount supports password-protected 7zip, right? I would think so but thought I'd confirm because was getting a few import error saying unable to open password-protected 7zip, but I think it's the articles themselves that are the issue.

@javi11 javi11 merged commit c65b18c into javi11:main Apr 22, 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.

3 participants