Skip to content

Commit

Permalink
refactor(plugin-media): remove existing stale artefact only if it's n…
Browse files Browse the repository at this point in the history
…ot a forced download
  • Loading branch information
critocrito committed Dec 21, 2018
1 parent 00705e3 commit fe0bf9a
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/plugin-media/lib/plugins/youtubedl.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,9 @@ const plugin = async (envelope, {cfg, log, stats}) => {

log.warn(`Failed to download video ${source}: ${ee.message}`);

await cleanUp(location);
// If we force a download and it fails, but the download exists
// already, better to keep the old one around.
if (downloadExists && !forceDownload) await cleanUp(location);

return media;
}
Expand Down

0 comments on commit fe0bf9a

Please sign in to comment.