Skip to content

Comments

fix(importer): prevent panic on NZB files with segment-less entries#306

Merged
javi11 merged 6 commits intojavi11:mainfrom
drondeseries:main
Feb 20, 2026
Merged

fix(importer): prevent panic on NZB files with segment-less entries#306
javi11 merged 6 commits intojavi11:mainfrom
drondeseries:main

Conversation

@drondeseries
Copy link
Contributor

Overview

Fixes a critical index out of range [0] panic in the NZB parser when processing malformed or incomplete NZB files that contain entries with zero segments. This was particularly prevalent when the parser fell back to fallbackGetFileInfos after failing to retrieve first-segment data from the network.

Changes

  • Parser Safety: Added a check in parseFile to return an error if a file has no segments, preventing a panic during segment sorting or first-segment access.
  • Fallback Logic: Updated fallbackGetFileInfos to proactively skip file entries that lack segments.
  • Normalization Fix: Modified normalizeSegmentSizesWithYenc to attempt fetching yEnc headers for the first segment if they aren't already cached, avoiding an issue where segment sizes were incorrectly set to zero during fallbacks.
  • Testing: Introduced internal/importer/parser/parser_test.go with unit tests for:
    • NZBs containing only empty segment entries.
    • Mixed NZBs with both valid and segment-less entries (ensuring correct filtering).
    • Basic fallback verification.

Impact

Improves system stability by preventing application crashes when encountering bad NZB data or experiencing network-related metadata fetch failures.

…k/strm paths

Also updates CI to use a cleaner dev image timestamp (YYYYMMDD-HHmm) in Eastern Time.
Fixes a critical 'index out of range [0]' panic in the NZB parser when processing files with empty segment lists. This often occurs during fallbacks after network validation failures.

- Added safety check in parseFile for empty segment slices.
- Updated fallbackGetFileInfos to skip files without segments.
- Improved normalizeSegmentSizesWithYenc to fetch missing first segment headers instead of zeroing out the size.
- Added comprehensive unit tests in parser_test.go covering empty and mixed segment scenarios.
This change introduces a new API endpoint to allow users to permanently reset their persistent import history.

- Added ClearImportHistory to the database Repository to perform the deletion.
- Added handleClearImportHistory API handler to process the request.
- Registered DELETE /api/import/history route in the server.
- Verified that NNTP provider errors can already be reset via POST /api/system/stats/reset.
…enabled

Ensures postprocessor uses the original full path for metadata lookup and mount path resolution, while using the stripped path only for the final destination in the import directory. This fixes 'no such file or directory' errors for symlink/STRM creation when complete_dir stripping is active.
@javi11 javi11 merged commit 5f5f044 into javi11:main Feb 20, 2026
1 check 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