fix: envoyer expected_volumes lors d'un replace pour tracker le download

Quand on fait un replace sans volumes manquants, expected_volumes n'était
pas envoyé → is_managed=false → pas d'insertion dans torrent_downloads
→ le torrent n'apparaissait pas dans la page downloads.

Maintenant un replace avec libraryId envoie toujours expected_volumes
(même vide) pour garantir le tracking.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-03-29 17:52:16 +02:00
parent ad0e9e5fa4
commit bedb588f50

View File

@@ -63,6 +63,7 @@ export function QbittorrentDownloadButton({
setSending(true);
setError(null);
try {
const vols = volumes || expectedVolumes;
const resp = await fetch("/api/qbittorrent/add", {
method: "POST",
headers: { "Content-Type": "application/json" },
@@ -70,7 +71,7 @@ export function QbittorrentDownloadButton({
url: downloadUrl,
...(libraryId && { library_id: libraryId }),
...(seriesName && { series_name: seriesName }),
...((volumes || expectedVolumes) && { expected_volumes: volumes || expectedVolumes }),
...(vols && vols.length > 0 ? { expected_volumes: vols } : replaceExisting && libraryId ? { expected_volumes: [] } : {}),
...(replaceExisting && { replace_existing: true }),
}),
});