Skip to content

fix: place folder-mode NZB and PAR2 in a per-folder output subdirectory#202

Merged
javi11 merged 1 commit intomainfrom
fix/folder-output-subdirectory-cross-volume
Apr 11, 2026
Merged

fix: place folder-mode NZB and PAR2 in a per-folder output subdirectory#202
javi11 merged 1 commit intomainfrom
fix/folder-output-subdirectory-cross-volume

Conversation

@javi11
Copy link
Copy Markdown
Owner

@javi11 javi11 commented Apr 11, 2026

Summary

  • Root cause: postFolder() placed NZB and PAR2 files directly in outputDir (filepath.Join(outputDir, folderName+".nzb")), so all generated files landed in the output root with no subfolder grouping.
  • Fix: Introduce folderOutputDir := filepath.Join(outputDir, folderName) and use it for both NZB path and par2OutputDir in the sequential and parallel branches of postFolder().
  • Result: Generated files are now organized as <outputDir>/<folderName>/<folderName>.nzb and <outputDir>/<folderName>/*.par2, fixing the cross-volume case where watch and output are on different mount points.

Before / After

Before (broken — cross-volume and same-volume):

/volume2/output/Movie_A.nzb
/volume2/output/file1.par2

After:

/volume2/output/Movie_A/Movie_A.nzb
/volume2/output/Movie_A/file1.par2

Test plan

  • TestPostFolderOutputSubdirectory — NZB lands in subfolder for sequential and parallel paths (5 sub-cases)
  • TestPostFolderMaintainPar2FilesSubdirectory — PAR2 executor receives subfolder as outputDir when maintain_par2_files=true (peer files); PAR2 files are in subfolder, not output root
  • TestPostFolderCrossVolumePathSeparation — explicit cross-volume simulation; output root contains only the named subdirectory
  • go test ./pkg/postie/... passes

Related #168

When Postie processes a watched folder (SingleNzbPerFolder or explicit
folder upload), generated NZB and PAR2 files are now placed inside a
dedicated <outputDir>/<folderName>/ subdirectory instead of directly in
the output root.

Before this fix, postFolder() used:
  nzbPath = filepath.Join(outputDir, folderName+".nzb")
  par2OutputDir = outputDir

Both paths now use folderOutputDir = filepath.Join(outputDir, folderName),
so the layout becomes:
  <outputDir>/Movie_A/Movie_A.nzb
  <outputDir>/Movie_A/*.par2   (when maintain_par2_files=true)

This fixes the cross-volume case (watch folder and output folder on
different mount points) where files were previously scattered in the
output root. The fix covers both the sequential (WaitForPar2=true) and
parallel (WaitForPar2=false) code paths.

Also bumps Node.js to v22 in CI workflows and adds tests covering:
- Sequential and parallel paths with maintain_par2_files=false
- Sequential and parallel paths with maintain_par2_files=true (peer files)
- Explicit cross-volume path separation scenario
@javi11 javi11 merged commit 1ee9a42 into main Apr 11, 2026
3 checks passed
@javi11 javi11 deleted the fix/folder-output-subdirectory-cross-volume branch April 11, 2026 16:50
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.

1 participant