Skip to content

Commit

Permalink
fix: better handle missing properties for name templating
Browse files Browse the repository at this point in the history
  • Loading branch information
lightpohl committed Jul 15, 2020
1 parent 10e9afa commit ae25272
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions bin/naming.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ let getFilename = ({ item, ext, url, feed, template }) => {
: null;

let templateReplacementsTuples = [
["title", item.title],
["release_date", formattedPubDate],
["title", item.title || ""],
["release_date", formattedPubDate || ""],
["url", url],
["podcast_title", feed.title],
["podcast_link", feed.link],
["duration", item.itunes && item.itunes.duration],
["podcast_title", feed.title || ""],
["podcast_link", feed.link || ""],
["duration", (item.itunes && item.itunes.duration) || ""],
];

let name = template;
Expand All @@ -41,8 +41,8 @@ let getFilename = ({ item, ext, url, feed, template }) => {

let getFolderName = ({ feed, template }) => {
let templateReplacementsTuples = [
["podcast_title", getSafeName(feed.title)],
["podcast_link", getSafeName(feed.link)],
["podcast_title", feed.title ? getSafeName(feed.title) : ""],
["podcast_link", feed.link ? getSafeName(feed.link) : ""],
];

let name = template;
Expand Down

0 comments on commit ae25272

Please sign in to comment.