Skip to content

fix(qbittorrent): multipart add, properties, files, and cache refresh#71

Open
Mika3578 wants to merge 2 commits into
got3nks:mainfrom
Mika3578:feat/qbittorrent-lazylibrarian-compat
Open

fix(qbittorrent): multipart add, properties, files, and cache refresh#71
Mika3578 wants to merge 2 commits into
got3nks:mainfrom
Mika3578:feat/qbittorrent-lazylibrarian-compat

Conversation

@Mika3578

@Mika3578 Mika3578 commented Jul 13, 2026

Copy link
Copy Markdown

Summary

Addresses review feedback on PR #71 for LazyLibrarian → aMuTorrent → aMule compatibility:

  • Cache refresh after add: invalidateBatchCache() on successful addEd2kLink(); properties / files retry with a forced DataFetchService fetch before returning 404
  • GET /api/v2/torrents/files?hash=: single-file response for ED2K downloads (LazyLibrarian getFiles() post-processing)
  • savepath handling: mapped to an aMule category by path when no category/label is set; explicit warnings when a per-torrent path is ignored or unmatched
  • Multipart hardening: Busboy limits, try/catch on construction, settled guard to avoid double next()
  • Automated tests: 19 node:test cases (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 test

Manual 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/add unchanged.

Rollback

Revert both commits; remove busboy if no longer needed elsewhere.

Mika3578 added 2 commits July 13, 2026 11:23
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
@Mika3578 Mika3578 changed the title fix(qbittorrent): LazyLibrarian compatibility (multipart add + properties) fix(qbittorrent): multipart add, properties, files, and cache refresh Jul 13, 2026
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