Skip to content

fix: use filepath.Rel for cross-volume NZB/PAR2 output paths#205

Merged
javi11 merged 4 commits intomainfrom
fix/cross-volume-output-dir
Apr 12, 2026
Merged

fix: use filepath.Rel for cross-volume NZB/PAR2 output paths#205
javi11 merged 4 commits intomainfrom
fix/cross-volume-output-dir

Conversation

@javi11
Copy link
Copy Markdown
Owner

@javi11 javi11 commented Apr 12, 2026

Summary

  • Replace brittle strings.TrimPrefix with filepath.Rel for computing relative output paths in non-folder mode, fixing NZB/PAR2 files landing in the watch folder instead of the configured output directory when they're on different drives
  • Add relativePathFrom helper that gracefully falls back when paths can't be made relative (e.g. cross-volume on Windows)
  • Enhance fake NNTP server in e2e tests to accept POST commands, enabling full upload-to-NZB e2e testing

Test plan

  • Unit tests: TestPostCrossVolumeNZBInOutputDir, TestPostInParallelCrossVolumeNZBInOutputDir, TestPostCrossVolumeWithSubdirectory
  • E2E tests: TestOutputDir_UploadPlacesNzbInOutputDir, TestOutputDir_ConfigPersistsRoundTrip, TestOutputDir_ConfigCanBeCleared, TestOutputDir_IndependentOfSingleNzbPerFolder
  • Manual: verify with watch folder on different drive than output folder, with "One NZB per Folder" disabled
  • go build ./... passes
  • go test -race ./pkg/postie/... passes
  • go vet ./... passes

🤖 Generated with Claude Code

javi11 and others added 4 commits April 12, 2026 17:09
Non-folder mode used strings.TrimPrefix to compute relative paths for
NZB and PAR2 output, which silently failed when watch and output folders
had different path prefixes (e.g. different drives). This caused output
files to land in the watch folder instead of the configured output
directory.

Replace all four TrimPrefix call sites with a new relativePathFrom
helper that uses filepath.Rel, matching the robust approach already
used by folder mode's deriveFolderName. When paths cannot be made
relative (cross-volume on Windows), falls back to placing output
directly in the output directory root.

Also enhance the e2e fake NNTP server to accept POST commands so
upload-to-NZB e2e tests can verify file placement end-to-end.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The TestOutputDir_UploadPlacesNzbInOutputDir test timed out in CI
because post_check was enabled with a 10s delay, making the upload
take too long. Disable post_check alongside par2 for faster completion.

Also fix TestOutputDir_ConfigCanBeCleared to use a real temp dir
instead of "/some/path" which caused permission denied errors when
the processor tried to create it.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The waitForQueueComplete helper used json:"total" but the /api/queue
endpoint returns "totalItems", so the field was always zero and the
poll loop never terminated.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Chromium on newer Linux kernels intermittently crashes with
"ThreadCache::IsValid" in scheduler_loop_quarantine_support.h.
Disabling the PartitionAlloc feature avoids this crash.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@javi11 javi11 merged commit 42f54a9 into main Apr 12, 2026
3 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.

1 participant