Skip to content

Fix malformed installer URLs for Windows 386 (32-bit)#41

Merged
bytemain merged 2 commits intomainfrom
copilot/fix-win-archtype-386-error
Apr 30, 2026
Merged

Fix malformed installer URLs for Windows 386 (32-bit)#41
bytemain merged 2 commits intomainfrom
copilot/fix-win-archtype-386-error

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 30, 2026

On Windows with archType=386, getReleaseForWindows produced malformed URLs (python-3.14.0-.exe, python-3.14.0..msi) that 404'd, making 32-bit installs impossible.

Two bugs in lib/util.lua:

  • MSI format string had a hardcoded . before the arch placeholder (%s/python-%s.%s.msi), producing a double-dot when arch is empty
  • EXE call site unconditionally prepended - to archType ('-' .. archType), producing a trailing dash when arch is empty

Fix

  • Remove the embedded dot from the MSI format string: %s/python-%s%s.msi
  • Compute full arch suffixes (separator + value, or empty) before formatting:
-- Before
if archType == "386" then archType = "" end
local url = DOWNLOAD_SOURCE.EXE:format(version, version, '-' .. archType)  -- → "python-3.14.0-.exe"
local url = DOWNLOAD_SOURCE.MSI:format(version, version, archType)          -- → "python-3.14.0..msi"

-- After
local exeArchSuffix, msiArchSuffix = "", ""
if archType ~= "386" then
    exeArchSuffix = "-" .. archType   -- e.g. "-amd64"
    msiArchSuffix = "." .. archType   -- e.g. ".amd64"
end
local url = DOWNLOAD_SOURCE.EXE:format(version, version, exeArchSuffix)  -- → "python-3.14.0.exe"
local url = DOWNLOAD_SOURCE.MSI:format(version, version, msiArchSuffix)  -- → "python-3.14.0.msi"
arch URL (before) URL (after)
386 EXE python-3.14.0-.exe python-3.14.0.exe
386 MSI python-3.14.0..msi python-3.14.0.msi
amd64 EXE python-3.14.0-amd64.exe python-3.14.0-amd64.exe
amd64 MSI python-3.14.0.amd64.msi python-3.14.0.amd64.msi

Copilot AI linked an issue Apr 30, 2026 that may be closed by this pull request
Copilot AI changed the title [WIP] Fix download issue when archType is 386 Fix malformed installer URLs for Windows 386 (32-bit) Apr 30, 2026
Copilot AI requested a review from bytemain April 30, 2026 14:05
@bytemain bytemain marked this pull request as ready for review April 30, 2026 14:18
@bytemain bytemain merged commit 7e933de into main Apr 30, 2026
4 checks passed
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.

win类型为386时报错

2 participants