diff --git a/internal/transfer/transfer.go b/internal/transfer/transfer.go index c5d0257..0285547 100644 --- a/internal/transfer/transfer.go +++ b/internal/transfer/transfer.go @@ -144,15 +144,20 @@ func (transfer *TransferStructure) HandleLabels() { // GetTrackers recurstive function for searching trackers in resume item trackers func (transfer *TransferStructure) GetTrackers(trackers interface{}) { switch strct := trackers.(type) { - case []interface{}: - for _, st := range strct { - transfer.GetTrackers(st) + case []string: + for _, str := range strct { + for _, str := range strings.Fields(str) { + transfer.Fastresume.Trackers = append(transfer.Fastresume.Trackers, []string{str}) + } } case string: for _, str := range strings.Fields(strct) { transfer.Fastresume.Trackers = append(transfer.Fastresume.Trackers, []string{str}) } - + case []interface{}: + for _, st := range strct { + transfer.GetTrackers(st) + } } } diff --git a/internal/transfer/transfer_test.go b/internal/transfer/transfer_test.go index 1abe0e7..24fafb2 100644 --- a/internal/transfer/transfer_test.go +++ b/internal/transfer/transfer_test.go @@ -1139,6 +1139,9 @@ func TestTransferStructure_GetTrackers(t *testing.T) { "test6", }, }, + []interface{}{ + []interface{}{"test7", "test8"}, + }, } expect := [][]string{ []string{"test1"}, @@ -1147,6 +1150,8 @@ func TestTransferStructure_GetTrackers(t *testing.T) { []string{"test4"}, []string{"test5"}, []string{"test6"}, + []string{"test7"}, + []string{"test8"}, } transferStructure.GetTrackers(testTrackers) if !reflect.DeepEqual(transferStructure.Fastresume.Trackers, expect) {