Add support for gzip-compressed NZB files (.nzb.gz)#530
Merged
Conversation
Upload endpoints, the directory scanner, and the watcher only matched the bare .nzb extension, so gzipped NZBs were rejected even though the downstream openNzbFile helper already decompresses them transparently. Centralize the extension check in nzbtrim.HasNzbExtension and apply it across the HTTP handlers, scanner, watcher, and frontend upload input.
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
This PR extends NZB file support to include gzip-compressed files (.nzb.gz) in addition to standard .nzb files across the application. A new utility function
HasNzbExtension()was introduced to centralize and standardize NZB file extension validation.Key Changes
HasNzbExtension()ininternal/importer/utils/nzbtrim/nzb_trim.goto check for both.nzband.nzb.gzextensions (case-insensitive)internal/api/sabnzbd_handlers.go(file upload and URL download handlers)internal/api/queue_handlers.go(queue upload handler)internal/api/nzb_stremio_handlers.go(Stremio NZB handler)internal/importer/scanner/directory.go(directory scanner)internal/importer/scanner/watcher.go(directory watcher)frontend/src/components/queue/ImportMethods.tsxto accept both.nzband.nzb.gzfilesacceptattribute to include.nzb.gzImplementation Details
HasNzbExtension()function performs case-insensitive matching by converting filenames to lowercase before checking suffixes.nzband.nzb.gzformats.nzbfile handlinghttps://claude.ai/code/session_01JrGP2iwN5ekVfdjpbfRJja