Skip to content

Commit

Permalink
fix: gracefully handle feed items missing audio extensions
Browse files Browse the repository at this point in the history
closes #24
  • Loading branch information
lightpohl committed May 9, 2021
1 parent 2672676 commit b0a03de
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions bin/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,11 @@ const writeItemMeta = ({ outputPath, item, key, archive, override }) => {

const getUrlExt = (url) => {
const { pathname } = _url.parse(url);

if (!pathname) {
return "";
}

const ext = path.extname(pathname);
return ext;
};
Expand All @@ -177,6 +182,11 @@ const VALID_AUDIO_EXTS = [...new Set(Object.values(AUDIO_TYPES_TO_EXTS))];

const getIsAudioUrl = (url) => {
const ext = getUrlExt(url);

if (!ext) {
return false;
}

return VALID_AUDIO_EXTS.includes(ext);
};

Expand Down

0 comments on commit b0a03de

Please sign in to comment.