Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Platform selection bug: darwin-arm64 extensions served instead of linux-x64 due to alphabetical sorting

Aperta
#122 1 commento 0 reazioni 1 assegnatario Vedi su GitHub

@code-asher ci sta già lavorando.

Dal 22/9/2025.

Valutazione

Questa issue non è ancora stata valutata.

Descrizione

bug

Bug Description

When using the /api/vscode/{publisher}/{extension}/latest endpoint (introduced in v2.4.0), the marketplace incorrectly serves darwin-arm64 extension variants instead of the appropriate platform-specific versions (e.g., linux-x64) due to alphabetical sorting of platform names.

Root Cause

The issue is in the ByVersion.Less() method in /storage/storage.go:

if vs[i].Version == vs[j].Version {
    return vs[i].TargetPlatform < vs[j].TargetPlatform
}

When multiple platform variants exist for the same semantic version (e.g., 2.36.4@darwin-arm64, 2.36.4@linux-x64), they are sorted alphabetically by platform string. Since "darwin-arm64" < "linux-x64" alphabetically, darwin-arm64 versions are always selected first when using IncludeLatestVersionOnly.

Impact

  • Extensions fail to install in VS Code/code-server running on Linux platforms
  • Affects all extensions that have multiple platform-specific variants
  • Introduced in v2.4.0 when the new /latest endpoint started being used by VS Code

Example Logs

Expected behavior (linux-x64 environment should get linux-x64 variant):

ComputeTargetPlatform: linux-x64
2025-09-20 09:42:42.565 [debu] GET /files/hashicorp/terraform/2.36.4@linux-x64/hashicorp.terraform-2.36.4@linux-x64.vsix

Actual behavior (linux-x64 environment incorrectly gets darwin-arm64 variant):

ComputeTargetPlatform: linux-x64
2025-09-20 09:42:40.247 [debu] GET /files/hashicorp/terraform/2.36.4@darwin-arm64/extension/package.json

Environment

  • code-marketplace version: v2.4.0
  • VS Code/code-server: 1.104.0
  • Platform: Linux x64 containers
  • Extensions affected: Any extension with multiple platform variants (e.g., HashiCorp Terraform)

Proposed Solutions

  1. Platform-aware filtering: Filter versions by the requesting client's target platform before sorting
  2. Universal version priority: Prioritize universal platform versions when available
  3. Platform preference order: Define a logical platform ordering instead of alphabetical (e.g., prefer common platforms like linux-x64 over darwin-arm64)
  4. Client platform detection: Extract target platform from request headers or query parameters

Reproduction Steps

  1. Set up code-marketplace v2.4.0
  2. Upload an extension with multiple platform variants (e.g., versions for both linux-x64 and darwin-arm64)
  3. Make a request to /api/vscode/{publisher}/{extension}/latest from a linux-x64 environment
  4. Observe that darwin-arm64 variant is returned instead of linux-x64

Workaround

Temporarily downgrade to v2.3.1 or modify the version sorting logic to prioritize the appropriate platform for your environment.

Lingua principale
Go
Stelle
369
Fork
46
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di coder/code-marketplace

Tutte le issue di coder/code-marketplace

Issue simili

Altre issue su Go

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.