fix(qbittorrent): multipart add, properties, files, and cache refresh#71
Open
Mika3578 wants to merge 2 commits into
Open
fix(qbittorrent): multipart add, properties, files, and cache refresh#71Mika3578 wants to merge 2 commits into
Mika3578 wants to merge 2 commits into
Conversation
LazyLibrarian and other qBittorrent clients send multipart/form-data on torrents/add and verify adds via torrents/properties. Add busboy parsing for the add endpoint and implement properties from cached torrent info.
- Invalidate DataFetchService cache after add and retry properties lookup with a forced refresh - Add GET /api/v2/torrents/files for post-download processing - Map savepath to aMule categories with explicit warnings when ignored - Harden multipart parser (limits, try/catch, settled guard) - Add node:test coverage for multipart, hash lookup, savepath, and cache refresh
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
Addresses review feedback on PR #71 for LazyLibrarian → aMuTorrent → aMule compatibility:
invalidateBatchCache()on successfuladdEd2kLink();properties/filesretry with a forcedDataFetchServicefetch before returning 404GET /api/v2/torrents/files?hash=: single-file response for ED2K downloads (LazyLibrariangetFiles()post-processing)savepathhandling: mapped to an aMule category by path when no category/label is set; explicit warnings when a per-torrent path is ignored or unmatchednext()node:testcases (multipart, urlencoded passthrough, hash resolution, savepath mapping, cache invalidation, files/properties mapping)Scope
This PR covers the qBittorrent API surface needed for LazyLibrarian snatch + post-download file discovery. Full end-to-end import validation (100% completion → LazyLibrarian import → cleanup) still depends on aMule network conditions and LazyLibrarian configuration.
Test plan
�ash cd server && npm testManual smoke (aMule connected):
`�ash
Multipart add
curl -b cookie.txt -X POST 'http://localhost:4000/api/v2/torrents/add'
-F 'urls=magnet:?xt=urn:btih:...' -F 'category=' -F '_dummy=@/dev/null'
Immediate properties lookup (should not 404 after cache refresh)
curl -b cookie.txt 'http://localhost:4000/api/v2/torrents/properties?hash='
File list for post-processing
curl -b cookie.txt 'http://localhost:4000/api/v2/torrents/files?hash='
`
Risk
Low — additive API behavior; existing urlencoded
torrents/addunchanged.Rollback
Revert both commits; remove
busboyif no longer needed elsewhere.