From 6d1cb47c7179d4df9913e563b31a0df68a6967e7 Mon Sep 17 00:00:00 2001 From: Sebastian-Webster <84299475+Sebastian-Webster@users.noreply.github.com> Date: Wed, 22 Oct 2025 16:26:02 +0800 Subject: [PATCH] Initialise downloadURL inside of try/catch block --- src/libraries/Downloader.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/libraries/Downloader.ts b/src/libraries/Downloader.ts index 27b251a..f5bc8f9 100644 --- a/src/libraries/Downloader.ts +++ b/src/libraries/Downloader.ts @@ -293,9 +293,10 @@ export function downloadBinary(binaryInfo: BinaryInfo, options: InternalServerOp let useDownloadsURL = false; do { - const downloadURL = binaryInfo.hostedByOracle ? `${useDownloadsURL ? MySQLCDNDownloadsBaseURL : MySQLCDNArchivesBaseURL}${url}` : await getFileDownloadURLRedirect(url) + let downloadURL: string = 'UNINITIALISED' try { downloadTries++; + downloadURL = binaryInfo.hostedByOracle ? `${useDownloadsURL ? MySQLCDNDownloadsBaseURL : MySQLCDNArchivesBaseURL}${url}` : await getFileDownloadURLRedirect(url) logger.log(`Starting download for MySQL version ${version} from ${downloadURL}.`) await downloadFromCDN(downloadURL, archivePath, logger) logger.log(`Finished downloading MySQL version ${version} from ${downloadURL}. Now starting binary extraction.`) @@ -358,7 +359,7 @@ export function downloadBinary(binaryInfo: BinaryInfo, options: InternalServerOp let useDownloadsURL = false; do { - const downloadURL = binaryInfo.hostedByOracle ? `${useDownloadsURL ? MySQLCDNDownloadsBaseURL : MySQLCDNArchivesBaseURL}${url}` : await getFileDownloadURLRedirect(url) + let downloadURL: string = 'UNINITIALISED' const uuid = randomUUID() const zipFilepath = `${dirpath}/${uuid}.${fileExtension}` logger.log('Binary filepath:', zipFilepath) @@ -366,6 +367,7 @@ export function downloadBinary(binaryInfo: BinaryInfo, options: InternalServerOp try { downloadTries++ + downloadURL = binaryInfo.hostedByOracle ? `${useDownloadsURL ? MySQLCDNDownloadsBaseURL : MySQLCDNArchivesBaseURL}${url}` : await getFileDownloadURLRedirect(url) logger.log(`Starting download for MySQL version ${version} from ${downloadURL}.`) await downloadFromCDN(downloadURL, zipFilepath, logger) logger.log(`Finished downloading MySQL version ${version} from ${downloadURL}. Now starting binary extraction.`)