Fix recursion bug in opml normalizer.

This commit is contained in:
Maurice Parker 2020-04-13 07:11:03 -05:00
parent 2ddc064696
commit 2ae511b818

View File

@ -23,6 +23,7 @@ final class OPMLNormalizer {
var feedsToAdd = [RSOPMLItem]()
items.forEach { (item) in
if let _ = item.feedSpecifier {
if !feedsToAdd.contains(where: { $0.feedSpecifier?.feedURL == item.feedSpecifier?.feedURL }) {
feedsToAdd.append(item)
@ -39,6 +40,13 @@ final class OPMLNormalizer {
}
feedsToAdd.append(item)
if let itemChildren = item.children {
if let parentFolder = parentFolder {
normalize(itemChildren, parentFolder: parentFolder)
} else {
normalize(itemChildren, parentFolder: item)
}
}
}
if let parentFolder = parentFolder {