fix(sabnzbd): Handle labels as array or string
All checks were successful
Build and Push Docker Image / build (push) Successful in 43s
Licence Check / Licence compatibility and copyright header verification (push) Successful in 1m7s
CI / Security audit (push) Successful in 1m28s
CI / Tests & coverage (push) Successful in 1m47s

SABnzbd API returns labels as an array in newer versions,
but the code assumed it was a comma-separated string.
Now handles both cases to prevent 'slot.labels.split is not a function' error.
This commit is contained in:
2026-05-19 21:43:58 +01:00
parent f22dd0d1f6
commit c5e8281440

View File

@@ -167,7 +167,7 @@ class SABnzbdClient extends DownloadClient {
speed: slot.kbpersec ? slot.kbpersec * 1024 : 0, // Convert KB/s to bytes/s
eta: this.calculateEta(slot.timeleft || slot.eta),
category: slot.cat || undefined,
tags: slot.labels ? slot.labels.split(',').filter(tag => tag.trim()) : [],
tags: slot.labels ? (Array.isArray(slot.labels) ? slot.labels : slot.labels.split(',')).filter(tag => tag && tag.trim()) : [],
savePath: slot.final_name || undefined,
addedOn: slot.added ? new Date(slot.added * 1000).toISOString() : undefined,
arrQueueId: arrInfo.queueId,