From 7447ca038a5fe0ed96a71951e65c273f450250ab Mon Sep 17 00:00:00 2001 From: Isaac Abadi Date: Thu, 18 May 2023 21:22:20 -0400 Subject: [PATCH] Fixed issue where empty temp archive files would get generated --- backend/subscriptions.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/backend/subscriptions.js b/backend/subscriptions.js index a6d2b18..e5ffa84 100644 --- a/backend/subscriptions.js +++ b/backend/subscriptions.js @@ -371,10 +371,13 @@ async function generateArgsForSubscription(sub, user_uid, redownload = false, de // skip videos that are in the archive. otherwise sub download can be permanently slow (vs. just the first time) const archive_text = await archive_api.generateArchive(sub.type, sub.user_uid, sub.id); - logger.verbose(`Generating temporary archive file for subscription ${sub.name} with ${archive_text.split('\n').length - 1} entries.`) - const archive_path = path.join(appendedBasePath, 'archive.txt'); - await fs.writeFile(archive_path, archive_text); - downloadConfig.push('--download-archive', archive_path); + const archive_count = archive_text.split('\n').length - 1; + if (archive_count > 0) { + logger.verbose(`Generating temporary archive file for subscription ${sub.name} with ${archive_count} entries.`) + const archive_path = path.join(appendedBasePath, 'archive.txt'); + await fs.writeFile(archive_path, archive_text); + downloadConfig.push('--download-archive', archive_path); + } if (sub.custom_args) { const customArgsArray = sub.custom_args.split(',,');