Skip to content

Commit 02a6184

Browse files
authored
Fix for when no "itunes:owner"
Hi @bobby-brennan, love this package, thank you for creating it. I've been getting some Typeerrors from feeds which have itunes fields but no "itunes:owner". I traced it to the "decorateItunes" function: it looks like `json.feed.itunes` is only created if there is an "itunes:owner"; if there isn't an *owner* but there are *other* itunes fields, the loop tries to add the PODCAST_TOP_FIELDS to `json.feed.itunes`, which obviously doesn't exist. So I just added a line to create the property either way. I doubt my fix is the ideal solution, but it seems to solve the problem for me!
1 parent 1ce1dc5 commit 02a6184

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

index.js

+2
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,8 @@ var decorateItunes = function decorateItunes(json, channel) {
151151
},
152152
image: channel['itunes:image'][0].$.href
153153
};
154+
} else {
155+
json.feed.itunes = {}
154156
}
155157
PODCAST_TOP_FIELDS.forEach(function(f) {
156158
if (channel['itunes:' + f]) json.feed.itunes[f] = channel['itunes:' + f][0];

0 commit comments

Comments
 (0)