fix(sabnzbd): Handle labels as array or string
All checks were successful
All checks were successful
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:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user