From 17ab9ad2a4604f03abecc8ba62805559b44dca4b Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 12 Dec 2025 08:57:38 +0000 Subject: [PATCH 1/6] Initial plan From 4eb699bfe9496f920bb26e906b942bd8b51b4a69 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 12 Dec 2025 09:02:12 +0000 Subject: [PATCH 2/6] Add automatic retry (3 times) when unzip fails Co-authored-by: aviraxp <18079988+aviraxp@users.noreply.github.com> --- scripts/fetch-data.ts | 59 +++++++++++++++++++++++++------------------ 1 file changed, 35 insertions(+), 24 deletions(-) diff --git a/scripts/fetch-data.ts b/scripts/fetch-data.ts index 4c06fb0..177175c 100644 --- a/scripts/fetch-data.ts +++ b/scripts/fetch-data.ts @@ -558,35 +558,46 @@ function replacePrivateImage(markdown: string, html: string): string { } async function extractModulePropsFromZip(downloadUrl: string): Promise> { - try { - // Extract module.prop content from zip URL (internal network, stable) - const { stdout: modulePropContent } = await execAsync(`runzip -p "${downloadUrl}" module.prop`, { - encoding: 'utf8', - maxBuffer: 64 * 1024 // 64KB buffer - }); - - // Parse module.prop content - const props: Record = {}; - if (!modulePropContent) return props; + const maxRetries = 3; + let lastError: any; - const lines = modulePropContent.split('\n'); - for (const line of lines) { - const trimmed = line.trim(); - if (!trimmed || trimmed.startsWith('#')) continue; + for (let attempt = 1; attempt <= maxRetries; attempt++) { + try { + // Extract module.prop content from zip URL (internal network, stable) + const { stdout: modulePropContent } = await execAsync(`runzip -p "${downloadUrl}" module.prop`, { + encoding: 'utf8', + maxBuffer: 64 * 1024 // 64KB buffer + }); + + // Parse module.prop content + const props: Record = {}; + if (!modulePropContent) return props; + + const lines = modulePropContent.split('\n'); + for (const line of lines) { + const trimmed = line.trim(); + if (!trimmed || trimmed.startsWith('#')) continue; + + const eqIndex = trimmed.indexOf('='); + if (eqIndex > 0) { + const key = trimmed.substring(0, eqIndex).trim(); + const value = trimmed.substring(eqIndex + 1).trim(); + props[key] = value; + } + } - const eqIndex = trimmed.indexOf('='); - if (eqIndex > 0) { - const key = trimmed.substring(0, eqIndex).trim(); - const value = trimmed.substring(eqIndex + 1).trim(); - props[key] = value; + return props; + } catch (err: any) { + lastError = err; + if (attempt < maxRetries) { + console.warn(`Failed to extract props from ${downloadUrl} (attempt ${attempt}/${maxRetries}): ${err.message}, retrying...`); + } else { + console.error(`Failed to extract props from ${downloadUrl} after ${maxRetries} attempts: ${err.message}`); } } - - return props; - } catch (err: any) { - console.error(`Failed to extract props from ${downloadUrl}: ${err.message}`); - return {}; } + + return {}; } const RESERVED_NAMES = ['.github', 'submission', 'developers', 'modules', 'org.kernelsu.example', "module_release"]; From 0271f1ec5d9ed7fa9fc61cb7e25f93fca211103b Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 12 Dec 2025 09:14:52 +0000 Subject: [PATCH 3/6] Fix retry logic to handle empty runzip content Co-authored-by: aviraxp <18079988+aviraxp@users.noreply.github.com> --- scripts/fetch-data.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/scripts/fetch-data.ts b/scripts/fetch-data.ts index 177175c..b38f8d5 100644 --- a/scripts/fetch-data.ts +++ b/scripts/fetch-data.ts @@ -569,10 +569,13 @@ async function extractModulePropsFromZip(downloadUrl: string): Promise = {}; - if (!modulePropContent) return props; - const lines = modulePropContent.split('\n'); for (const line of lines) { const trimmed = line.trim(); From 8652bfd2f82d695a74fb5515ab177d0100701768 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 12 Dec 2025 09:15:53 +0000 Subject: [PATCH 4/6] Improve retry error messages and whitespace handling Co-authored-by: aviraxp <18079988+aviraxp@users.noreply.github.com> --- scripts/fetch-data.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/fetch-data.ts b/scripts/fetch-data.ts index b38f8d5..186da7a 100644 --- a/scripts/fetch-data.ts +++ b/scripts/fetch-data.ts @@ -569,9 +569,9 @@ async function extractModulePropsFromZip(downloadUrl: string): Promise Date: Fri, 12 Dec 2025 09:33:44 +0000 Subject: [PATCH 5/6] Add exponential backoff delay between retry attempts Co-authored-by: aviraxp <18079988+aviraxp@users.noreply.github.com> --- scripts/fetch-data.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/fetch-data.ts b/scripts/fetch-data.ts index 186da7a..b9cdabc 100644 --- a/scripts/fetch-data.ts +++ b/scripts/fetch-data.ts @@ -594,6 +594,8 @@ async function extractModulePropsFromZip(downloadUrl: string): Promise setTimeout(resolve, 1000 * attempt)); } else { console.error(`Failed to extract props from ${downloadUrl} after ${maxRetries} attempts: ${err.message}`); } From 67ca2402d6674043916d63f86d1833c905470f86 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 12 Dec 2025 09:34:39 +0000 Subject: [PATCH 6/6] Update comment to accurately describe delay pattern Co-authored-by: aviraxp <18079988+aviraxp@users.noreply.github.com> --- scripts/fetch-data.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/fetch-data.ts b/scripts/fetch-data.ts index b9cdabc..40c1fd1 100644 --- a/scripts/fetch-data.ts +++ b/scripts/fetch-data.ts @@ -594,7 +594,7 @@ async function extractModulePropsFromZip(downloadUrl: string): Promise setTimeout(resolve, 1000 * attempt)); } else { console.error(`Failed to extract props from ${downloadUrl} after ${maxRetries} attempts: ${err.message}`);