Skip to content

Fix bizard-skill.zip download link resolving to wrong path on sub-pages#277

Merged
ShixiangWang merged 2 commits intomainfrom
copilot/fix-bizard-skill-zip-path
Apr 16, 2026
Merged

Fix bizard-skill.zip download link resolving to wrong path on sub-pages#277
ShixiangWang merged 2 commits intomainfrom
copilot/fix-bizard-skill-zip-path

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 16, 2026

The bizard-skill.zip download link was broken on any page below the site root (e.g. Distribution/Density.html), resolving to /bizard-skill.zip instead of /Bizard/bizard-skill.zip.

Root Cause

The JS path calculation subtracted only 2 from parts.length — accounting for the leading '' and the site root segment — but forgot to subtract the filename itself:

// Before: off by one — counts the filename as a directory to traverse
var segmentsAfterRoot = parts.length - 2;

// After: correctly excludes '', site-root, and the filename
var segmentsAfterRoot = Math.max(0, parts.length - 3);

For /Bizard/Distribution/Density.html (parts.length = 4):

  • Before: 4 - 2 = 2../../bizard-skill.zip/bizard-skill.zip
  • After: max(0, 4 - 3) = 1../bizard-skill.zip/Bizard/bizard-skill.zip

Changes

  • skill-button.lua — fixes the button injected into every tutorial page
  • Skills.qmd / Skills.zh.qmd — fixes the same logic on the Skills landing pages

The segmentsAfterRoot calculation used parts.length - 2 (subtracting
only the empty string and site root), but forgot to subtract the
filename itself. Pages like /Bizard/Distribution/Density.html ended
up with ../../bizard-skill.zip resolving to /bizard-skill.zip instead
of /Bizard/bizard-skill.zip.

Fix: use Math.max(0, parts.length - 3) in skill-button.lua,
Skills.qmd, and Skills.zh.qmd.

Agent-Logs-Url: https://github.com/openbiox/Bizard/sessions/e8c5f250-0592-47e3-8660-74694f4374fd

Co-authored-by: ShixiangWang <25057508+ShixiangWang@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix Bizard skill zip path inconsistencies on website Fix bizard-skill.zip download link resolving to wrong path on sub-pages Apr 16, 2026
Copilot AI requested a review from ShixiangWang April 16, 2026 06:56
@ShixiangWang ShixiangWang marked this pull request as ready for review April 16, 2026 06:58
@ShixiangWang ShixiangWang merged commit 8ca2140 into main Apr 16, 2026
@ShixiangWang ShixiangWang deleted the copilot/fix-bizard-skill-zip-path branch April 16, 2026 06:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bizard-skill.zip 在网页上的路径问题

2 participants