CLI cannot load explicitly selected config paths containing # or %

Aperta
#1,371 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
35/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
node.js, typescript
Ambito
cli, tooling

Direzione di ricerca

Start with loadConfig() in src/cli/internal.ts and the reproduction in src/cli/config.test.ts. Check how explicit paths and MPPX_CONFIG reach import(), then run the focused config tests. Done means filenames containing # or %20 load correctly and the returned path and selection precedence remain unchanged.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Check existing issues
Describe the bug

On current main, an explicitly selected CLI config exists on disk but fails to load if its filename contains a literal # or %20. A plain filename with the same contents loads normally. I reproduced this through both the explicit argument and MPPX_CONFIG, without making a request or using a wallet.

loadConfig() passes an absolute filesystem path directly to import(), which interprets URL syntax in the path instead of preserving the filename. The expected result is to load the selected file and return its original filesystem path, without changing selection or precedence.

Link to Minimal Reproducible Example

https://github.com/Osraka/mppx/blob/c170d1b36ef4f6a2c2669e7abebe999430d600b7/src/cli/config.test.ts#L58-L74

Steps To Reproduce

From the repository root at 4cd2cd25, after installing the repo dependencies:

dir=$(mktemp -d)
config="$dir/config#draft%20v2.mjs"
printf 'export default { methods: [] }\n' > "$config"
node --import tsx --input-type=module --eval 'import { loadConfig } from "./src/cli/internal.ts"; console.log(await loadConfig(process.argv[1]))' "$config"

The file exists, but the import fails. Repeat with config.mjs in the same directory to see the passing control.

Package Version

0.22.1 (main at 4cd2cd25)

Anything else?

Reproduced on macOS arm64 with Node.js 22.21.0. I prepared a narrow fix that converts the selected path to a file URL only at the import boundary. The two regression tests fail on main; with the fix, the focused config suite passes 11/11 and the direct Node matrix passes 8/8. The linked regression file is on the fixed branch; the steps above reproduce against main.

The repository currently limits PRs to collaborators, so here is the three-file diff for review if useful.

Lingua principale
TypeScript
Stelle
196
Fork
79
Merge medio
15h 20m
PR unite (30g)
156

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

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 wevm/mppx

Tutte le issue di wevm/mppx

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.