ToNamespacedPath doesn't work with device names
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- JavaScript
- Sterne
- 122k
- Forks
- 37.3k
- Ø Merge
- 4 T. 2 Std.
- Gemergte PRs (30 T.)
- 283
Beschreibung
Version
v20.16.0
Platform
Microsoft Windows NT 10.0.22635.0 x64
Subsystem
No response
What steps will reproduce the bug?
import path from 'node:path'
console.log(path.toNamespacedPath("COM3"))
How often does it reproduce? Is there a required condition?
Every time.
What is the expected behavior? Why is that the expected behavior?
This should print:
\\.\COM3
which is the fully qualified path in the device namespace
What do you see instead?
This prints the illegal path:
\\?\C:\Users\dan\COM3
Additional information
Reference for legal path name: https://learn.microsoft.com/en-us/windows/win32/fileio/naming-a-file#win32-device-namespaces
Additionally console.log(url.pathToFileURL("COM3").href) prints an invalid URL, but I'm not sure if there is a corresponding valid file: URL.
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Beginne mit der node:path toNamespacedPath("COM3")-Reproduktion unter Windows und vergleiche sie mit dem erwarteten Gerätenamespace-Pfad \.\COM3. Prüfe das Verhalten von url.pathToFileURL("COM3") als zusätzlichen Kontext; fertig ist es, wenn die path API den zulässigen Gerätepfad zurückgibt, ohne normale Pfade zu beeinträchtigen.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- javascript, node.js
- Bereich
- backend, operating-systems
- Issue-Typ
- Bug
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Aktivitätsstatus
- Ruhig
- Klarheit
- Klar beschrieben
- Anfängerfreundlichkeit
- 68/100